Hi all,

I'm new to this list so I hope somebody hasn't 
just posted about the same topic.

I'm using matplotlib 0.98.5.2 (rev 6660) with 
python 2.5 under windows, and ran across an old 
bug which was (supposedly) fixed in rev 5922.
(http://www.mailinglistarchive.com/matplotlib-users@lists.sourceforge.net/msg00271.html)

I'm displaying two plots in one frame (split 
horizontally, first plot is 211 and second is 
212). Whenever I hover the plot frame (at any 
position), I get this annoying LinAlgError exception.

The fix (in patches.py) is testing in a Rectangle 
if self._height==0 or self._width==0, then return 
false. But when I add a print statement in the 
contains() methos, I see that the rectangle has 
indeed self._height=1.0 and self._width=1.0. So I 
changed the code into a try-catch :

     def contains(self, mouseevent):

##        # special case the degenerate rectangle
##        if self._width==0 or self._height==0:
##            return False, {}

         try :
             x, y = self.get_transform().inverted().transform_point(
                 (mouseevent.x, mouseevent.y))
         except np.linalg.LinAlgError, lae :
             return False, {}

         return (x >= 0.0 and x <= 1.0 and y >= 0.0 and y <= 1.0), {}


it now runs smoothly. Is there any case where a 
LinAlgError *should* be legitimately raised here 
? Otherwise I believe this try-catch is enough to get rid of the bug.


dl.

===================================
Damien Leroux
Responsable Informatique plate-forme anexplo

Hôpital de Rangueil / Inserm-IFR 150
BP 84 225
31432 - Toulouse - Cedex 04

tel       05 61 32 56 45
mobile 06 82 92 31 78 


------------------------------------------------------------------------------
Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT
is a gathering of tech-side developers & brand creativity professionals. Meet
the minds behind Google Creative Lab, Visual Complexity, Processing, & 
iPhoneDevCamp asthey present alongside digital heavyweights like Barbarian
Group, R/GA, & Big Spaceship. http://www.creativitycat.com 
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to