contour's polygons

Hi,

I'm 6 months into learning python and haven't been able to find a way
to do this, so I hope you don't mind a basic question.

I'd like to use the polygons contour makes but I can't figure out how
to get them from ContourSet. Any examples or links to helpful
information would be excellent.

Thanks,
Phil

···

--
Phil Rosenfield
Graduate Student: UW Astronomy
Additional contact info:
http://www.astro.washington.edu/philrose

Attached is an example of how to extract the polygons from a ContourSet.

contour_polygons.py (1.41 KB)

···

On 28 July 2010 01:31, Phil Rosenfield <philrose@…248…> wrote:

I’d like to use the polygons contour makes but I can’t figure out how

to get them from ContourSet. Any examples or links to helpful

information would be excellent.

Hi,

I'm 6 months into learning python and haven't been able to find a way
to do this, so I hope you don't mind a basic question.

I'd like to use the polygons contour makes but I can't figure out how
to get them from ContourSet. Any examples or links to helpful
information would be excellent.

They are buried. Each contour set has a list of collections, and
each of those collections has a set of paths, and each of those paths has a vertices attribute for its corresponding polygon. In the following we will pick out the first path of the first collection.

cs = contour(rand(6,6))
c = cs.collections[0]
p = c.get_paths()[0]
v = p.vertices

lev = cs.levels[0]

The levels attribute is a list of levels corresponding to the list of collections: one collection per level.

Eric

···

On 07/27/2010 02:31 PM, Phil Rosenfield wrote:

Thanks,
Phil