简体   繁体   中英

Matplotlib increase font size of right y-axis ticks?

I have a plot with a left and right y-axis. I want to increase the font sizes of the y-axis tick params, but it seems that only the left side y-axis font size is increasing. Code:

fig, ax = plt.subplots(2,1,figsize=(15, 15))
ax[0].tick_params(axis='both', labelsize=14)
ax[1].tick_params(axis='both', labelsize=14)

# the right y-axis:
ax[0].set_ylabel('left Y',fontsize=18)
ax[0].right_ax.set_ylabel('right Y',fontsize=18)

What is the way to increase the font size for right_ax.set_ylabel ?

EDIT: Solution I found: ax[0].right_ax.set_ylabel('right-Y',fontsize=20)

Edited my question to post this solution I found:

ax[0].right_ax.set_ylabel('right-Y',fontsize=20)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM