mouse tracking with two y-axes

Hi all,

i have a plot with 2 y-axes and 1 x-axis. The mouse pointer shows the
y-coordinates of the second y-axis, but I want the mouse pointer to show the
y-coordinate of the first y-axis.

Is there a way how to switch the mouse pointer to the first y-axis?

Thanks & regards,

peter

···

--
View this message in context: http://old.nabble.com/mouse-tracking-with-two-y-axes-tp27144406p27144406.html
Sent from the matplotlib - users mailing list archive at Nabble.com.

If you have overlapping axes using twinx, or twiny, the one with with
higher zorder gets the mouse signal. Using
http://matplotlib.sourceforge.net/examples/api/two_scales.html for
reference, both have a zorder of 1 and ax2 gets the signal be default.
Unfortunately, one cannot simply set

  ax1.set_zorder(1)

While this does cause ax1 to get the mouse events and the toolbar
reports the coords from ax1, it is not hidden behind ax2 since "twiny"
does other stuff like making the "upper" axes frame invisible. So to
move ax1 to the top and have the figure draw correctly, you need

In [115]: ax1.set_zorder(0.1)

In [116]: ax1.set_frame_on(False)

In [117]: ax2.set_frame_on(True)

It would be nice to have a property like "receive_mouse" attached to
the axes which could be controlled/toggled from the figure window so
one could easily switch between which overlapping axes receives mouse
events.

JDH

···

On Wed, Jan 13, 2010 at 6:59 AM, boriq <borique@...287...> wrote:

Hi all,

i have a plot with 2 y-axes and 1 x-axis. The mouse pointer shows the
y-coordinates of the second y-axis, but I want the mouse pointer to show the
y-coordinate of the first y-axis.

Is there a way how to switch the mouse pointer to the first y-axis?