Contour Data

Matlab 's contour function returns the contour data as x- and y- coordinates in a contour matrix C:

[C,H] = CONTOUR(…)

pylab.contour(…) returns a ContourSet object that only seems to contain contour heights. How do I get the actual contour data? I need the (x,y) coordinates as given by matlab. In fact even the binary contour image that is displayed by contour() will be usefull.

albert

Albert Swart wrote:

Matlab 's contour function returns the contour data as x- and y- coordinates in a contour matrix C:
[C,H] = CONTOUR(...)

You are using an old version of Matlab...

pylab.contour(...) returns a ContourSet object that only seems to contain contour heights. How do I get the actual contour data? I need the (x,y) coordinates as given by matlab. In fact even the binary contour image that is displayed by contour() will be usefull.
albert

The ContourSet object includes the attribute "collections", a list of LineCollections or PolyCollections (for contour and contourf, respectively), with one collection per line or color band. For each collection in the list, you can access the vertices using the get_verts() method.

Eric