Paul Ivanov wrote:

> 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)

Hmm. I do not get a reversed list of axes. This is the output of
the example code below:

[<matplotlib.axes.AxesSubplot object at 0x8d8fb4c>, <matplotlib.axes.Axes 
object at 0x8f633ec>]
[<matplotlib.axes.AxesSubplot object at 0x8d8fb4c>, <matplotlib.axes.Axes 
object at 0x8f633ec>]

BTW, what's matplotlib.axes.AxesSubplot? I couldn't find this class.

Ciao
Andreas



import pylab as mpl

mpl.plot([1,3,2])
mpl.twinx()
mpl.plot([400,50,100])

f = mpl.gcf()

print f.axes

f.axes[0].set_frame_on(False)
f.axes.reverse()
f.axes[0].set_frame_on(True)

print f.axes

mpl.show()


------------------------------------------------------------------------------
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