Thanks for the workaround. I got it to work for the labels and title, but not axes tick labels.
This still seems like a regression bug to me. Especially since matplotlib's own example code clearly shows that picking labels, titles, and tick labels outside the axes region should be possible with the standard picker. If the current picker behavior is the desired behavior, then the example code should at least be updated to show the new way to pick objects outside the axes. Thanks again, -Ben ________________________________ From: Jae-Joon Lee [mailto:lee.j.j...@gmail.com] Sent: Monday, February 01, 2010 3:48 PM To: Ben Axelrod Cc: matplotlib-users@lists.sourceforge.net Subject: Re: [Matplotlib-users] Label picker broken? Current "pick" implementation explicitly checks if the event is inside the axes. So, you cannot pick artists outside the axes area. This seems more like an intended "feature" than a bug, but I may be wrong. And my guess is that this is to prevent picking invisible artists (as they are clipped). While others may have better advice, mine is to use "button pressed" event directly. lab = ax1.set_ylabel('ylabel', picker=True, bbox=dict(facecolor='red')) def picklabel(artsits, mouseevent): for a in artsits: a.pick(mouseevent) from functools import partial b1 = fig.canvas.mpl_connect('button_press_event', partial(picklabel, [lab])) Regards, -JJ On Fri, Jan 29, 2010 at 12:06 PM, Ben Axelrod <baxel...@coroware.com<mailto:baxel...@coroware.com>> wrote: Picking text outside of the axes region seems to be broken in matplotlib 0.99.1 and in the latest SVN. This functionality used to work in version 0.98.3. The example code pick_event_demo.py demonstrates the issue. The "ylabel" in the red box is no longer pickable. Is there a "clip_on" or similar setting on the picker that needs to be set now? Below is a simplified version of "pick_event_demo.py" for reference. I also added some text to the plot to make sure that text inside the axes region was still pickable. Thanks, -Ben #!/usr/bin/env python # simplified example code: pick_event_demo.py from matplotlib.pyplot import figure, show from matplotlib.lines import Line2D from matplotlib.patches import Patch, Rectangle from matplotlib.text import Text from matplotlib.image import AxesImage import numpy as npy from numpy.random import rand fig = figure() ax1 = fig.add_subplot(111) ax1.set_title('click on points, rectangles or text', picker=True) ax1.set_ylabel('ylabel', picker=True, bbox=dict(facecolor='red')) ax1.text(50, 0.5, "pick me", picker=True) line, = ax1.plot(rand(100), 'o', picker=5) # 5 points tolerance 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() fig.canvas.mpl_connect('pick_event', onpick1) show() #end code Ben Axelrod Robotics Engineer (800) 641-2676 x737 [cid:875170521@01022010-3682] www.coroware.com<http://www.coroware.com/> www.corobot.net<http://www.corobot.net/> ------------------------------------------------------------------------------ The Planet: dedicated and managed hosting, cloud storage, colocation Stay online with enterprise data centers and the best network in the business Choose flexible plans and management services without long-term contracts Personal 24x7 support from experience hosting pros just a phone call away. http://p.sf.net/sfu/theplanet-com _______________________________________________ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net<mailto:Matplotlib-users@lists.sourceforge.net> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
<<inline: image002.gif>>
------------------------------------------------------------------------------ The Planet: dedicated and managed hosting, cloud storage, colocation Stay online with enterprise data centers and the best network in the business Choose flexible plans and management services without long-term contracts Personal 24x7 support from experience hosting pros just a phone call away. http://p.sf.net/sfu/theplanet-com
_______________________________________________ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users