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:109365016@29012010-0A93]
www.coroware.com<http://www.coroware.com/>
www.corobot.net<http://www.corobot.net/>

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

Reply via email to