subplot - Python: add y labels on both sides of plot -


i have series of 8 subplots, sharing x-axis , sharing 1 colorbar:

f, ax = plt.subplots(8, sharex=true) in range(8):     data = np.random.random((100,100))     im = ax[i].pcolormesh(data)     ax[i].set_ylabel(i) f.colorbar(im,  ax=ax.ravel().tolist(), orientation='vertical') 

enter image description here

i want add second y-label on right side of of these plots; lets want label them a-h.

i attempted adding empty parasite axis each subplot. fails when adding colorbar in end. ylabel_2 = ['a','b','c','d','e','f','g','h']

f, ax = plt.subplots(8, sharex=true) in range(8):     data = np.random.random((100,100))     im = ax[i].pcolormesh(data)     ax[i].set_ylabel(i)     ax2 = ax[i].twinx()     ax2.set_ylabel(ylabel_2[i])     ax2.yaxis.set_major_locator(plt.nulllocator()) f.colorbar(im,  ax=ax.ravel().tolist(), orientation='vertical') 

enter image description here

what best way accomplish want?


Comments

Popular posts from this blog

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

python Tkinter Capturing keyboard events save as one single string -

sql server - Why does Linq-to-SQL add unnecessary COUNT()? -