# fill function

I just read your question more closely -- that you want to multiply an array by an array that describes the polygon. Do you mean the array of vertices that describe the polygon or something like a 2D rasterization (image) of the polygon?

I perhaps wrongfully assumed you just wanted to do hit-testing on a polygon. What I was thinking (and this still may be relevant to your problem) was:

···

====

from matplotlib.path import Path

# Create a unit square
path = Path([[0, 0], [1, 0], [1, 1], [0, 1], [0, 0]])

# Test for some points that are inside and outside of the square
assert path.contains_point([0.5, 0.5])
assert not path.contains_point([1.5, 0.5])

====

If you want to get an image of the polygon, it's probably theoretically doable, but won't be straightforward. It will involve working directly with the Agg backend, I think. Let me know your use case is, and we can step through that. Perhaps there's another way to achieve the same end result that won't require as much wrestling.

Cheers,
Mike

Bryan Fodness wrote:

Could you help me set this up? I am still fairly new to python.
On Thu, Jun 5, 2008 at 1:05 PM, Michael Droettboom <mdroe@…86… > <mailto:mdroe@…86…>> wrote:

If you're using 0.98, you can create a Path object (see path.py)
from your polygon and then use the point_in_polygon method to test
whether a point is inside or outside the polygon. This doesn't
require rendering the polygon at all and works entirely in vector
space. Let me know if you need help with the details.

Cheers,
Mike

Bryan Fodness wrote:

Is there a way to get the underlying array that the fill
function uses to graph a polygon?
This is assuming that it uses an array. I would like to be
able to multiple an array by an array that describes the
polygon (one if inside the polygon and zero if outside)

-- "The game of science can accurately be described as a
never-ending insult to human intelligence." - Jo�o Magueijo
------------------------------------------------------------------------

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
------------------------------------------------------------------------

_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
<mailto:Matplotlib-users@lists.sourceforge.net>
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

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

--
"The game of science can accurately be described as a never-ending insult to human intelligence." - Jo�o Magueijo

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