twinx/twiny usage

Hi,

I am trying to overlay a few Axes object that need to share axes. I would like it to be the case that if I change the properties of one axis (e.g., scale), the corresponding axis of the other axes will have the properties changed automatically. I was trying to use twinx/twiny, but this behavior failed. After looking at the code, it appears to me that the sharex/sharey parameters to the Axes class never actually copies the axis instances of the given axes object. Is this intentional? If I want to get properties to be connected between axis objects in different axes, could I manually assign the xaxis attribute of one axes to reference an Axis instance in a different axes object? Or would this make everything break?

Thanks!
Uri

···


Uri Laserson
PhD Candidate, Biomedical Engineering
Harvard Medical School (Genetics)
Massachusetts Institute of Technology (Mathematics)
phone +1 917 742 8019
laserson@…1166…

Hi,

I am trying to overlay a few Axes object that need to share axes. I would
like it to be the case that if I change the properties of one axis (e.g.,
scale), the corresponding axis of the other axes will have the properties
changed automatically. I was trying to use twinx/twiny, but this behavior
failed. After looking at the code, it appears to me that the sharex/sharey
parameters to the Axes class never actually copies the axis instances of the
given axes object. Is this intentional? If I want to get properties to be
connected between axis objects in different axes, could I manually assign
the xaxis attribute of one axes to reference an Axis instance in a different
axes object? Or would this make everything break?

Axis in matplotlib is partly a transform (not exactly, but sort of)
and partly an artist. And it became tricky to share axis among
different axes.
The solution depends on details of what you want. If the scale is set
before twin is called, than the twined axes will have a same scale as
the original. If you need to change the scale after the axes is
twined, you need to manually change the all shared axes
(get_shared_x_axes and get_shared_y_axes would be helpful).
Also, depending on you need, the ParasiteAxes in axes_grid toolkit may
be useful.

Regards,

-JJ

···

On Wed, Aug 12, 2009 at 3:16 PM, Uri Laserson<laserson@...1166...> wrote:

Thanks!
Uri

--
Uri Laserson
PhD Candidate, Biomedical Engineering
Harvard Medical School (Genetics)
Massachusetts Institute of Technology (Mathematics)
phone +1 917 742 8019
laserson@...1166...

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus
on
what you do best, core application coding. Discover what's new with
Crystal Reports now. http://p.sf.net/sfu/bobj-july
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
matplotlib-users List Signup and Options