Plots with two scales for the y axis

Hello,

I tried to improve the way of plotting two scales (cf examples/two_scales.py). The attached patch contains the following changes:

in axis.py: allow right side label, so both y axes can get one. axis instances get a new property: label_position, which is left or right for yaxis, top or bottom for xaxis.

in axes.py: a new Axes subclass (TwinAxes) that shares the x axis with another. Transforms are set accordingly (lazy values for x lims are shared). This avoids having to change the xlim or xlabel (and so on) 2 times.

in pylab.py: a new command (twin) that returns the twin of an axes instance (the current one by default), thus making it into a two scales plot.

How to use: see the new examples/two_scales.py for the typical use case.

Cheers,
BC

twin.diff (9.55 KB)

Hello,

I got confused with my two patches. The pylab.py chunk from the other patch actually belongs here.
Sorry for that, I'll send a corrected version tomorrow, I need some sleep :slight_smile:

Cheers,
BC

Hello,

here is the corrected patch, sorry for the noise.

Cheers,
BC

twin.diff (10.1 KB)