python - matplotlib: ylabel on the secondary y-axis with manual tick placing -


i want have y-label on secondary y-axis in matplotlib. i'm aware, twinx() trick so:

ax2 = twinx(ax1) ax2.set_ylabel('some thing') 

however, ax1 has non-standard tick placing , duplicate ax2 not copy property, have explicitly adjust ticks again.

is there better way this?

although haven't found, how label both axes on single subplot, found solution axes matrix:

fig, axs = subplots(2, 2, sharex=true, sharey=true) axs[0, 0].set_ylabel('on left default') axs[0, 1].yaxis.set_label_position('right') axs[0, 1].set_ylabel('...now on right y-axis') 

hope helps other people, too.


Comments