Hi Andreas,

On Fri, Sep 23, 2011 at 2:08 PM, Andreas Matthias
<andreas.matth...@gmail.com> wrote:
> In the following example the coordinates of the mouse
> cursor displayed in the pylab window belong to the
> second y-axis. But I would prefer to have the coordinates
> of the first y-axis to be displayed. Is this possible?

yes it is.

> import pylab as mpl
>
> mpl.plot([1,3,2])
> mpl.twinx()
> mpl.plot([400,50,100])
> mpl.show()

# get the current figure
f = mpl.gcf()

# Hide the "background" for the first axes, otherwise it will block
the second one when we swap
f.axes[0].set_frame_on(False)

# Swap the axes
f.axes.reverse()

# Turn on the "background" for the *new* first axes (the one that was
created second)
f.axes[0].set_frame_on(False)

you can also achieve the same effect by changing the zorder of axes -
provided that you remember to have turn the frame on for the one that
is the furthest back, and turn it off for all others lying on top of
it. You can see what happens if you don't do this by omitting the
calls to set_frame_on, and then verifying that the second line does
not show up (because the original axes' frame patch is blocking it.

best,
-- 
Paul Ivanov
314 address only used for lists,  off-list direct email at:
http://pirsquared.org | GPG/PGP key id: 0x0F3E28F7

------------------------------------------------------------------------------
All of the data generated in your IT infrastructure is seriously valuable.
Why? It contains a definitive record of application performance, security
threats, fraudulent activity, and more. Splunk takes this data and makes
sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-d2dcopy2
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to