필터 지우기
필터 지우기

Get data from Contour plots

조회 수: 9 (최근 30일)
Lavkesh Lachhvani
Lavkesh Lachhvani 2011년 6월 8일
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
Lavkesh Lachhvani 2011년 6월 9일
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
mohammad pourtousi 2013년 5월 7일
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