Multiple 2-D area plots in a 3-D graph

15 次查看(过去 30 天)
Hi everyone! I need to plot several 2-D (positive)curves orthogonal to the "x,y plane" in a 3-D plot and I would need to fill the area beneath each 2-D curve. In other words, each filled 2-D graph should lie in an plane orthogonal to "x,y" and the projection of each filled graph should be a different line in the "x,y" plane (not necessarily parallel to each other). Does it exist a matlab function for this sort of task?
I already tried with "fill3". It plots the orthogonal 2-D filled curves but I don't know how to set the curve in the z-axis to an arbitrary function instead of just a straight line.
figure
X = [0 0;1 -0.5;1 -0.5];
Y = [0 0;1 -0.3;1 -0.3];
Z = [0 0;0 0;0.5 0.5];
C = [1.0000;
1.0000;
1.0000];
fill3(X,Y,Z,C)
Can anybody help me?

回答(3 个)

Star Strider
Star Strider 2014-6-14
You may want to experiment with the area plot:
x = linspace(0,10);
figure(1)
area(x, sin(0.5*pi*x).^2, 'FaceColor',[0 0 1])
hold on
area(x, 2+10*exp(-((x+5).^2)*10)+sin(7*pi*x)*1, 'BaseValue', 2, 'FaceColor',[1 0 0])
area(x, 4+10*exp(-((x+5).^2)*10)+sin(sin(0.5*pi*x)*3*pi)*1, 'BaseValue', 4, 'FaceColor',[0 1 0])
hold off
  2 个评论
Image Analyst
Image Analyst 2014-6-14
riccardo's "Answer" moved here:
Thanks for the suggestion. I have already tried with "area" plot but all the "area" plots lay in the "x,y" plane. Is there a way to rotate them in a 3-D plot and set them to an arbitrary location in the space? (Not necessarily all parallel to each other)
Star Strider
Star Strider 2014-6-14
I can’t run your code because ‘Polyhedron’ is not defined.
See if the File Exchange (FES) contribution Line Plot 3D will do what you want. I don’t know if it produces the filled areas below the line, but it otherwise may do what you want.
The only other option I can suggest is the bar3 function.

请先登录,再进行评论。


krishna teja
krishna teja 2020-4-14
use watefall command
it does exactly same as what you want
Nactions = 5;
Ntime = 5;
x = (1:Nactions); % actions
y = (1:Ntime); % time
[X,Y] = meshgrid(x,y);
z = rand(Ntime,Nactions);
w = waterfall(X,Y,z)
w.EdgeColor = 'b';
w.EdgeAlpha = 0.5;
w.FaceColor = 'b';
w.FaceAlpha = 0.2;
xlabel('actions')
ylabel('time')
zlabel('probabilities')
title('waterfall')

riccardo
riccardo 2014-6-14
编辑:Star Strider 2014-6-14
Another test I made is the following. What I would need in this case is to fill the area beneath each curve. Any suggestion??
ExtremePoints = [ 1.3 -5.8; -6.2 -3.4; +4.2 5.2; -5.8 -7.7];
P5 = Polyhedron([ 1.3 -5.8; -6.2 -3.4; +4.2 5.2; -5.8 -7.7]);
P5.plot('color', 'lightblue');
hold on;
plot3(x_1, -0.7*x_1, y_1(x_1));
plot3(x_1, x_1, y_1(x_1));
axis auto;
zlim([0, 100])
  1 个评论
Star Strider
Star Strider 2014-6-14
I can’t run your code because ‘Polyhedron’ is not defined.
See if the File Exchange (FES) contribution Line Plot 3D will do what you want. I don’t know if it produces the filled areas below the line, but it otherwise may do what you want.
The only other option I can suggest is the bar3 function.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Data Exploration 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by