On Mon, Feb 13, 2012 at 2:59 PM, Jerzy Karczmarczuk <jerzy.karczmarczuk@unicaen.fr> wrote:


>>> th= array([ 4.65542641,  5.32920696,  2.20928291])
>>> p=patch.Polygon(array([cos(th),sin(th)]).T)
>>> print p.contains_point((0,0))
>>> print matplotlib.nxutils.pnpoly(0,0,p.get_path().vertices)


I can confirm this for both the current development branch and v1.1.x.  Strange....

Ben Root

HYPOTHESIS (I have no time to check now everything..., I did my best.)

If radius=None, it is converted into radius=1 in contains_point (in Patch).
(This is the linewidth !)
I am not sure whether it is ok, i.e. in pixels. If this value is considered to be relative to axes, it is enormous!


gives 0 as it should.

Jerzy Karczmarczuk

P.S. I suggest anyway that reckoner submits a complete program with imports. What is "patch"??

Jerzy is right.  contains() and contains_point() both takes a radius argument as this function is intended for use when mouse-clicking.  If no radius is given, it uses the object's linewidth and passes it to the path's contains_point() function with its transform.  I *suspect* that the problem is that the transforms haven't been fully defined yet and might be incorrectly testing this.

This needs a bit more investigation to see if this is the intended behavior or if something needs to be fixed.

As a side note, "patch" is an imported module via "from matplotlib import patches as patch".  Not standard among mpl devs, but not out of the ordinary.

Ben Root