Overlay curves on an existing surface plot
显示 更早的评论
How to add/overlay curves on an existing plot that was done by a surf() function? I have tried doing that before, but some of the curves are totally lost in the blue colors of my surf()plot.
I read somewhere that I could use "plot3()" BEFORE using surf(), however, my plots are in 2-D (I am using view(2), because I just want to obtain the Feasible region), and I am not quite sure how to use plot3() in this case. Any idea?
1 个评论
Torbjörn Pettersson
2019-5-16
You are correct the it is good to use plot3. If you do this before or after you have generated the surf do not matter (I normaly di it after the surf).
The command plot3 adds the z to the ploted line/point, and you need to set the "z" value higher than maximum z in the data you use in the surf.
I will give the following code as an example showing the difference between plot and plot3 together with surf.
[X,Y,Z] = peaks(25);
figure
surf(X,Y,Z);
view(2), shading interp
hold on
plot([-3 3],[0 0], 'k-')
plot3([-3 3],[0.25 0.25],[25 25], 'b-')
The black line from the plot command will not be visible. But the plot3 shows on top when I use 25 for z.
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Line Plots 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!