onpick on a 2 y plot ( via twinx() ) seems to only allow picking of second axes's artists

Good day,

I've hit an issue that may be a bug. In a previous version of
matplotlib (.98.x) I had a picker set for lines plotted on two axes.
This was working until I upgraded to version 0.99.0. Now the first
axes's pick events never seem to fire even though they respond true if
queried with pickable(). The second axes's pick events still fire.

Using the example below, clicking on the left y's line will never
print anything, but the sin from the right will if clicked.

OS: Windows XP Pro
Python: 2.6
matplotlib version: 0.99.0 -- installed using the python2.6 windows
exe obtained from sourceforge

Code to reproduce:

import numpy as np
import matplotlib.pyplot as plt

fig = plt.figure()
ax1 = fig.add_subplot(111)
t = np.arange(0.01, 10.0, 0.01)
s1 = np.exp(t)
ax1.plot(t, s1, 'b-', picker = 4.0)
ax1.set_xlabel('time (s)')
# Make the y-axis label and tick labels match the line color.
ax1.set_ylabel('exp', color='b')
for tl in ax1.get_yticklabels():
   tl.set_color('b')

ax2 = ax1.twinx()
s2 = np.sin(2*np.pi*t)
ax2.plot(t, s2, 'r.', picker = 4.0)
ax2.set_ylabel('sin', color='r')
for tl in ax2.get_yticklabels():
   tl.set_color('r')

def onpick(event):
   thisline = event.artist
   xdata = thisline.get_xdata()
   ydata = thisline.get_ydata()
   ind = event.ind
   print 'onpick points:', zip(xdata[ind], ydata[ind])

fig.canvas.mpl_connect('pick_event', onpick)

plt.show()

Thanks for a wonderful plotting package!

···

--
View this message in context: http://www.nabble.com/onpick-on-a-2-y-plot-(-via-twinx()-)-seems-to-only-allow-picking-of-second-axes's-artists-tp24971445p24971445.html
Sent from the matplotlib - users mailing list archive at Nabble.com.