contains methods

Hi,

I fixed some of the contains() methods so at least the simple
cases work.

Degenerate rectangles cause problems in axes_demo:

import matplotlib.patches
r = matplotlib.patches.Rectangle((0,0),1,0)
r.get_transform().inverted()

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/matplotlib/transforms.py", line 1338, in inverted
    self._inverted = Affine2D(inv(mtx))
  File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/numpy-1.1.0-py2.5-macosx-10.3-fat.egg/numpy/linalg/linalg.py", line 332, in inv
    return wrap(solve(a, identity(a.shape[0], dtype=a.dtype)))
  File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/numpy-1.1.0-py2.5-macosx-10.3-fat.egg/numpy/linalg/linalg.py", line 235, in solve
    raise LinAlgError, 'Singular matrix'
numpy.linalg.linalg.LinAlgError: Singular matrix

I've only gone through the a*.py samples, but there are a few other glitches
such as not detecting axhline/axvline, not handling rotated text properly,
and not doing very well on polar plots. These will have to wait for another
release.

  - Paul

Paul Kienzle wrote:

Hi,

I fixed some of the contains() methods so at least the simple
cases work.

Degenerate rectangles cause problems in axes_demo:

import matplotlib.patches
r = matplotlib.patches.Rectangle((0,0),1,0) r.get_transform().inverted()
        

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/matplotlib/transforms.py", line 1338, in inverted
    self._inverted = Affine2D(inv(mtx))
  File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/numpy-1.1.0-py2.5-macosx-10.3-fat.egg/numpy/linalg/linalg.py", line 332, in inv
    return wrap(solve(a, identity(a.shape[0], dtype=a.dtype)))
  File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/numpy-1.1.0-py2.5-macosx-10.3-fat.egg/numpy/linalg/linalg.py", line 235, in solve
    raise LinAlgError, 'Singular matrix'
numpy.linalg.linalg.LinAlgError: Singular matrix
  

I see how this works with your example code, but how does this relate to axes_demo.py? I suppose the contains method will have to check for a singular matrix and just return False.
   

I've only gone through the a*.py samples, but there are a few other glitches
such as not detecting axhline/axvline, not handling rotated text properly,
and not doing very well on polar plots. These will have to wait for another
release.
  

Agreed. Though if you can believe it, things are much better than they once were, particularly for polygons.

Cheers,
Mike

···

--
Michael Droettboom
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA