MATLAB Answers

Plot multiple 2D contour plots in one 3D figure

70 views (last 30 days)
I have multiple 2D contour plots that I'd like to plot in one 3D figure one on top of the other with some distance in between each of the plots. How to do this?

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 28 Aug 2019
You can achieve this by modifying the 'ContourZLevel' property of the contour plots. For example, the following plots two contour plots with some distance between them in the Z-direction:
[X,Y,Z] = peaks;
hold on
[~,h] = contour(X,Y,Z,20); % plot contour at the bottom
h.ContourZLevel = -9;
[~,h] = contour(X,Y,Z,20); % plot contour at the top
h.ContourZLevel = +9;
hold off
view(3);

  0 Comments

Sign in to comment.

More Answers (1)

Dimitrios Vogiatzis
Dimitrios Vogiatzis on 11 Nov 2019
Edited: Dimitrios Vogiatzis on 11 Nov 2019
Hello, In relation to this question I want to ask another one.
I have several 2d contour maps (X,Y,Z1), (X,Y,Z2) .... where Z1,Z2,Z3=const (see figure for Z1) and I have a question:
I want to visualize a contour volume map interpolating the points between the maps and filling the Z axis with 2D maps.
Does anybody know if it is possible to visualize this volume?
X,Y maps in Z1=36, Z1=65, Z3=80
bsfc1.jpg
The code for creating each one of the 2d contour maps (c1,c2,c3) is the following.
figure ;
c1 = contourf(rpm1,bmep3_new,bsfc1_new,20);
set(gca,'ColorScale','log')
c=jet(30);
colormap(c);

  0 Comments

Sign in to comment.

Products


Release

R2018b

Translated by