degenerate matrix when moving mouse over a plot

Hi all,

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

I'm using matplotlib (rev 6660) with python 2.5 under windows, and ran across an old bug which was (supposedly) fixed in rev 5922.

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



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