How to decide if a plot is surf or mesh based on graphics handle data?
이전 댓글 표시
Lets say I have a 3D plot which I want to export to another format, can I in any way tell if the plot is a surface, or a mesh by analyzing the result of get(gca)/get(gcf)/get(handle)?
With
x = -3:0.1:3;
y = -3:0.1:3;
[X Y] = meshgrid(x,y);
R = sqrt(X.^2+Y.^2);
Z = R;
figure
h1 = mesh(X,Y,Z);
a1 = get(gca);
f1 = get(gcf);
J1 = get(h1);
figure
h2 = surf(X,Y,Z);
a2 = get(gca);
f2 = get(gcf);
J2 = get(h2);
the only (initial) difference I can find (unless I'm blind) is:
[J1.EdgeColor = 'flat' J2.EdgeColor = [0 0 0]]
[J1.FaceColor = [1 1 1] J2.FaceColor = 'flat']
[J1.FaceLighting = 'none' J2.FaceLighting = 'flat']
[J1.EdgeLighting = 'flat' J2.EdgeLighting = 'none']
At first I thought I could do a check
if isnumeric( faceColor ) && strcmpi( edgeColor, 'flat' )
plotType = 'mesh'
end
the EdgeColor in the example is set to black, thus being numeric, and my test is indeed wrong.
So the big question is, how can I distinguish the two without looking at the plot?
(the purpose is to export the plot to TikZ/PGF using the LaTeX package pgfplots, however, I need to find out whether to use surf or mesh).
best regards, dm
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Lighting, Transparency, and Shading에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!