pylab.ylabel: put label on the other side

Antoine De Groote antoinedg at gmail.com
Mon Dec 15 11:32:00 EST 2008


Hey everybody,

I'm plotting graphs with 2 y-axes, which I created using

ax_left = pylab.subplot(111)
ax_right = pylab.twinx()

Then I switch the sides of the ticks:

ax_left.yaxis.tick_right()
ax_right.yaxis.tick_left()

This works, the ticks are on the opposite sides (left axis ticks are on
the right side and vice-versa).

But, when I want to label the y-axes with for example

pylab.axes(ax_left)
pylab.ylabel('Some label')

they are on the wrong side, i.e. not on the same side as the ticks of
the corresponding y-axis. For this example, the label would be on the
left side instead of the right side.

This is giving me headaches for quite a few hours now, so maybe somebody
knows a solution.

Regards,
antoine



More information about the Python-list mailing list