how to convert a 3D surface into a 2D contour?
23 次查看(过去 30 天)
显示 更早的评论
Hi,
I have a 3D surface(download: https://uploadkon.ir/uploads/9ced27_24input.zip) and I want to convert it into a 2D contour like the image below. but I dont know how.
ps: the colorbar in the 2D plot shows the variation of y-axis in the 3D plot.
1 个评论
Torsten
2024-1-27
I'd just change the view to be frontal on the xz-plane when plotting the surface :-)
回答(2 个)
Sulaymon Eshkabilov
2024-1-27
This is how it can be done:
H = openfig('ds2.fig'); % This is the extracted plot figure
h = findobj(gca, 'Type', 'surface');
X = get(h, 'XData'); % Extract XData
Y = get(h, 'YData'); % Extract YData
Z = get(h, 'ZData'); % Extract YData
figure
plot(X, Z)
plot(X, Z)
xlabel("X")
ylabel("Z")
grid on
Sulaymon Eshkabilov
2024-1-28
Note that it is clear from the colorbar scale (Figure 2 in your question) that there must be another operation before obtaining the plot (Figure 2 in your question) that is missing in your question.
Anyhow, here is another way of getting a similar plot.
H = openfig('ds2.fig'); % This is the extracted plot figure
view(360,0)
xlabel("X")
zlabel("Z")
grid on
xlim([0, 2])
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Contour Plots 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!