简体   繁体   中英

different axes limits for multiple plots in matplotlib

Trying to implement the following code:

f, ((ax1,ax2,ax3,ax4,ax5,ax6,ax7,ax8)) = plt.subplots(8,1, sharey =True, sharex=True)


for i in (ax1, ax2, ax3, ax4):
    i.set_ylim(0,100000)

for i in(ax5, ax6, ax7, ax8):
    i.set_ylim(0,5000)

However, the y-axis in all 8 axes set to 0,5000... I do not understand why as I have stated in the for loop the correct axes to use.

The sharey keyword argument does this. Disable it if you don't want identical y axes in all the subplots.

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