Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project!

## matplotlib-users

 [Matplotlib-users] matplotlib have "point in a polygon" test? From: David Goldsmith - 2008-06-27 03:37:49 ```Hi! Does matplotlib have already implemented a method to return true/false according as a provided point is inside a provided polygon? Thanks! DG ```
 Re: [Matplotlib-users] matplotlib have "point in a polygon" test? From: David Warde-Farley - 2008-06-27 03:46:28 ```On 26-Jun-08, at 11:37 PM, David Goldsmith wrote: > Hi! Does matplotlib have already implemented a method to return > true/false according as a provided point is inside a provided > polygon? Thanks! In [15]: help matplotlib.nxutils -------> help(matplotlib.nxutils) Help on module matplotlib.nxutils in matplotlib: NAME matplotlib.nxutils - general purpose utilities (numpy). FILE /Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/ site-package s/matplotlib/nxutils.so FUNCTIONS pnpoly(...) inside = pnpoly(x, y, xyverts) return 1 if x,y is inside the polygon defined by the sequence of x,y ver tices in xyverts points_inside_poly(...) mask = points_inside_poly(xypoints, xyverts) return a mask of length xypoints indicating whether each x,y point is in side the polygon defined by the sequence of x,y vertices in xyverts If you're interested in the algorithm: http://www.ecse.rpi.edu/Homepages/wrf/Research/Short_Notes/pnpoly.html Regards, David ```
 Re: [Matplotlib-users] matplotlib have "point in a polygon" test? From: David Goldsmith - 2008-06-27 04:07:15 ```Excellent, thanks! Just reinforces my belief that in Python, if you need to do something, chances are the Python tool for it already exists in the Public Domain! I love Python! DG --- On Thu, 6/26/08, David Warde-Farley wrote: > From: David Warde-Farley > Subject: Re: [Matplotlib-users] matplotlib have "point in a polygon" test? > To: d_l_goldsmith@... > Cc: matplotlib-users@... > Date: Thursday, June 26, 2008, 8:46 PM > On 26-Jun-08, at 11:37 PM, David Goldsmith wrote: > > > Hi! Does matplotlib have already implemented a method > to return > > true/false according as a provided point is inside a > provided > > polygon? Thanks! > > In [15]: help matplotlib.nxutils > -------> help(matplotlib.nxutils) > Help on module matplotlib.nxutils in matplotlib: > > NAME > matplotlib.nxutils - general purpose utilities > (numpy). > > FILE > > /Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/ > > site-package > s/matplotlib/nxutils.so > > FUNCTIONS > pnpoly(...) > inside = pnpoly(x, y, xyverts) > return 1 if x,y is inside the polygon defined by > the sequence > of x,y ver > tices in xyverts > > points_inside_poly(...) > mask = points_inside_poly(xypoints, xyverts) > return a mask of length xypoints indicating > whether each x,y > point is in > side the polygon defined by the sequence of x,y vertices in > xyverts > > If you're interested in the algorithm: > > http://www.ecse.rpi.edu/Homepages/wrf/Research/Short_Notes/pnpoly.html > > > Regards, > > David ```