The pick radius for the X and Y axis artists are one-sided; is that
intentional?

Original (in class XAxis), file axis.py:

    def contains(self,mouseevent):
        """Test whether the mouse event occured in the x axis.
        """
        if callable(self._contains): return self._contains(self,mouseevent)

        x,y = mouseevent.x,mouseevent.y
        try:
            trans = self.axes.transAxes.inverted()
            xaxes,yaxes = trans.transform_point((x,y))
        except ValueError:
            return False, {}
        l,b = self.axes.transAxes.transform_point((0,0))
        r,t = self.axes.transAxes.transform_point((1,1))
        inaxis = xaxes>=0 and xaxes<=1 and (
                   (y<b and y>b-self.pickradius) or
                   (y>t and y<t+self.pickradius))
        return inaxis, {}


Corrected:

    def contains(self,mouseevent):
        """Test whether the mouse event occured in the x axis.
        """
        if callable(self._contains): return self._contains(self,mouseevent)

        x,y = mouseevent.x,mouseevent.y
        try:
            trans = self.axes.transAxes.inverted()
            xaxes,yaxes = trans.transform_point((x,y))
        except ValueError:
            return False, {}
        l,b = self.axes.transAxes.transform_point((0,0))
        r,t = self.axes.transAxes.transform_point((1,1))
        inaxis = xaxes>=0 and xaxes<=1 and (
                   (y<b+self.pickradius and y>b-self.pickradius) or   # <---
change on this line
                   (y>t-self.pickradius and y<t+self.pickradius))   # <---
change on this line
        return inaxis, {}

-- 
Daniel Hyams
dhy...@gmail.com
------------------------------------------------------------------------------
All of the data generated in your IT infrastructure is seriously valuable.
Why? It contains a definitive record of application performance, security
threats, fraudulent activity, and more. Splunk takes this data and makes
sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-d2dcopy2
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to