Get data from Contour plots

5 次查看(过去 30 天)
Lavkesh Lachhvani
Hi all,
I have been using matlab since quite long. I want to get data from the stored contour plot file. I can get it's handle using hggroup, but I don't know how to extract data from this ?
Can anybody help ?
thanx in advance..

回答(4 个)

Walter Roberson
Walter Roberson 2011-6-9
The Children of the hggroup are a set of patches, one patch per contour level.
The patches are basically X/Y/Z lists of coordinates, with the Z originally set to be constant at the contour level. The transitions between the various regions of contouring are, if I recall correctly, done by sticking NaN in to the list of points where the breaks are.
After the utility routine constructs all of these patches, the contour() routine deliberately goes through and sets the Z coordinates for all of the patches to 0, destroying the original Z. Fortunately, the utility routine that constructed the layered patches also stored the patch level (Z coordinate) in the UserData field associated with the patch, so it is possible to determine which patch is which by looking at its UserData field.
The contour regions are sometimes quite irregular, especially if two regions with the same level touch each other: in such a case it is not certain that those two regions will be done through X1 NAN X2 NAN or if it will just build X1 X2 NAN.

Lavkesh Lachhvani
Thanks Walter for your explanation, I got the way to extract data, here it is...
plot1 = openfig('*.fig');
h1 = findall(plot1,'Type','hggroup');
X1 = get(h1(2),'XData');
Y1 = get(h1(2),'YData');
Z1 = get(h1(2),'ZData');

Roman Voronov
Roman Voronov 2013-2-12
This works for contour3, for contour the Z is empty

mohammad pourtousi
Hello I have some single data based on x,y,z .I want to contour them. Actually x,y are show rectangular geometry and z shows pressure in this geometry.
How Can i contour them? Thanks

类别

Help CenterFile Exchange 中查找有关 Contour Plots 的更多信息

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by