Multiple 2D contour plots in a single 3D plot

19 views (last 30 days)
Please I want the 2D contour plots to be arranged along either the X or Y axis. That is, the Z-axis of 45, 75, and 90 should rather be placed in either the X or Y-axis.
Kindly see the code I'm currently using below. Thank you
[y,x] = meshgrid(2:1:8,0:2.5:7.5);
set(gca,'position',[0.15 0.25 0.8 0.60],'fontname','times new roman','fontsize',20);
[~,h] = contourf(x,y,Z1,25,'edgecolor','none'); % plot contour at the bottom
h.ContourZLevel = 90;
[~,h] = contourf(x,y,Z2,25,'edgecolor','none'); % plot contour at the bottom
h.ContourZLevel = 75;
[~,h] = contourf(x,y,Z3,25,'edgecolor','none'); % plot contour at the bottom
h.ContourZLevel = 45;
hold off
camup([0 0 0])
zlim([30 90]);
caxis([0.05 2])

Answers (1)

Shubham Rawat
Shubham Rawat on 26 Mar 2021
As per my understanding, you will not be able to do this. There is no Property as such.
You are plotting contour on XY axis so its Z axis is empty. Now you want to fill that with some value "h.ContourZLevel", which is the height of that plot.
But if you want to change X or Y values, it is not valid to change existing values of Data.
Hope this Helps!

Sign in to comment.


Find more on Contour Plots in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!