text picker

Text picking does not seem to work for me anymore since I upgraded from
0.91.4 to 0.98.1.

These lines should set up the picker. They come straight from “pick_event_demo.py”

ax1.set_title('click on points, rectangles or text',

picker=True)

ax1.set_ylabel('ylabel', picker=True,

bbox=dict(facecolor=‘red’))

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

def onpick1(event):

    if isinstance(event.artist,

Line2D):

thisline = event.artist

xdata = thisline.get_xdata()

ydata = thisline.get_ydata()

        ind

= event.ind

print ‘onpick1 line:’, zip(npy.take(xdata, ind), npy.take(ydata, ind))

    elif

isinstance(event.artist, Rectangle):

patch = event.artist

print ‘onpick1 patch:’, patch.get_path()

    elif

isinstance(event.artist, Text):

        text

= event.artist

print ‘onpick1 text:’, text.get_text()

I apologize if this is a known issue. I tried searching the listserve,
but did not find anything.

-Ben

This is fixed in matplotlib svn and will be out in the next release.

···

On Tue, Jul 29, 2008 at 10:55 AM, Ben Axelrod <baxelrod@...2066...> wrote:

Text picking does not seem to work for me anymore since I upgraded from
0.91.4 to 0.98.1.