Revision: 5888
          http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5888&view=rev
Author:   pkienzle
Date:     2008-07-26 19:17:05 +0000 (Sat, 26 Jul 2008)

Log Message:
-----------
Fix contains method for inverted image axes

Modified Paths:
--------------
    trunk/matplotlib/lib/matplotlib/image.py

Modified: trunk/matplotlib/lib/matplotlib/image.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/image.py    2008-07-26 18:42:22 UTC (rev 
5887)
+++ trunk/matplotlib/lib/matplotlib/image.py    2008-07-26 19:17:05 UTC (rev 
5888)
@@ -50,6 +50,9 @@
 
     interpnames = _interpd.keys()
 
+    def __str__(self):
+        return "AxesImage(%g,%g;%gx%g)" % tuple(self.axes.bbox.bounds)
+
     def __init__(self, ax,
                  cmap = None,
                  norm = None,
@@ -243,11 +246,15 @@
         # collection on nonlinear transformed coordinates.
         # TODO: consider returning image coordinates (shouldn't
         # be too difficult given that the image is rectilinear
+        x, y = mouseevent.xdata, mouseevent.ydata
         xmin, xmax, ymin, ymax = self.get_extent()
-        xdata, ydata = mouseevent.xdata, mouseevent.ydata
-        #print xdata, ydata, xmin, xmax, ymin, ymax
-        if xdata is not None and ydata is not None:
-            inside = xdata>=xmin and xdata<=xmax and ydata>=ymin and 
ydata<=ymax
+        if xmin > xmax:
+            xmin,xmax = xmax,xmin
+        if ymin > ymax:
+            ymin,ymax = ymax,ymin
+        #print x, y, xmin, xmax, ymin, ymax
+        if x is not None and y is not None:
+            inside = x>=xmin and x<=xmax and y>=ymin and y<=ymax
         else:
             inside = False
 


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Matplotlib-checkins mailing list
Matplotlib-checkins@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins

Reply via email to