Multiple 2-D area plots in a 3-D graph
15 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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?
0 Kommentare
Antworten (3)
Star Strider
am 14 Jun. 2014
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 Kommentare
Image Analyst
am 14 Jun. 2014
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
am 14 Jun. 2014
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
am 14 Apr. 2020
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')
1 Kommentar
riccardo
am 14 Jun. 2014
Bearbeitet: Star Strider
am 14 Jun. 2014
1 Kommentar
Star Strider
am 14 Jun. 2014
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.
Siehe auch
Kategorien
Mehr zu Data Exploration finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!