From: <md...@us...> - 2008-02-19 15:52:19
|
Revision: 4979 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4979&view=rev Author: mdboom Date: 2008-02-19 07:52:06 -0800 (Tue, 19 Feb 2008) Log Message: ----------- Fixing picking on masked arrays (Thanks Andrew Straw) Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/axes.py trunk/matplotlib/lib/matplotlib/lines.py Modified: trunk/matplotlib/lib/matplotlib/axes.py =================================================================== --- trunk/matplotlib/lib/matplotlib/axes.py 2008-02-19 15:35:45 UTC (rev 4978) +++ trunk/matplotlib/lib/matplotlib/axes.py 2008-02-19 15:52:06 UTC (rev 4979) @@ -215,7 +215,8 @@ b = self.axes.yaxis.update_units(y) if b: return npy.arange(len(y)), y, False - y = ma.asarray(y) + if not ma.isMaskedArray(y): + y = npy.asarray(y) if len(y.shape) == 1: y = y[:,npy.newaxis] nr, nc = y.shape Modified: trunk/matplotlib/lib/matplotlib/lines.py =================================================================== --- trunk/matplotlib/lib/matplotlib/lines.py 2008-02-19 15:35:45 UTC (rev 4978) +++ trunk/matplotlib/lib/matplotlib/lines.py 2008-02-19 15:52:06 UTC (rev 4979) @@ -75,6 +75,9 @@ """Determine if any line segments are within radius of a point. Returns the list of line segments that are within that radius. """ + import pdb + pdb.set_trace() + # Process single points specially if len(x) < 2: res, = npy.nonzero( (cx - x)**2 + (cy - y)**2 <= radius**2 ) @@ -97,7 +100,7 @@ # following radius test eliminates these ambiguities. point_hits = (cx - x)**2 + (cy - y)**2 <= radius**2 #if any(point_hits): print "points",xr[candidates] - candidates = candidates & ~point_hits[:-1] & ~point_hits[1:] + candidates = candidates & ~(point_hits[:-1] | point_hits[1:]) # For those candidates which remain, determine how far they lie away # from the line. @@ -308,7 +311,7 @@ # transform in backend if len(self._xy)==0: return False,{} - xyt = self.get_transform().transform(self._xy) + xyt = self._transformed_path.get_fully_transformed_path().vertices xt = xyt[:, 0] yt = xyt[:, 1] This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |