필터 지우기
필터 지우기

Multiple 2D plot in 1 3D plot

조회 수: 79 (최근 30일)
Meryeme BOUMAHDI
Meryeme BOUMAHDI 2017년 5월 18일
편집: Eshan Maitra 2024년 5월 14일
Hello, I'm looking for a way to draw multiple 2d plot in 3D plot. I have a vector time=[1,2,3,4,5]; I want to plot it as x-axis. I have also 3 vector as the data that I want to plot. It' depend just about time and every vector belong to a value of Z. So I have 3 plot p1(x,y); p2(x,y); p3(x,y); p1 belong to z=0.1 p2 z=0.3 p3 z=0.3; Y depend just about time and Z is fixed.
I'm looking for results like this Thank you

채택된 답변

KSSV
KSSV 2017년 5월 19일
N = 8 ;
t = 1:20 ;
data = rand(N,20) ;
figure
hold on
for i = 1:N
plot3(t,i*ones(size(t)),data(i,:))
end
view(3)
  댓글 수: 3
Saurabh Shukla
Saurabh Shukla 2020년 9월 17일
Hello KSSV. This perfectly worked for me. But I want to do something additional. I want to construct another line plot by joining data tips at different today stacks. I will explain it like this.
Let's suppose there are 2D graphs (in x-y plane), and there are 4 of them stacked in z axis. Now I want a plot in y-z axis, at some constant value of x. is this possible?
Eshan Maitra
Eshan Maitra 2024년 5월 14일
편집: Eshan Maitra 2024년 5월 14일
I logged in first time just to upvote this comment! Best (simplest one understand and learn from) answer to this question asked so many others! Thank you!

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

krishna teja
krishna teja 2020년 4월 14일
use waterfall command
example
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
Van Trung Tin HUYNH
Van Trung Tin HUYNH 2023년 1월 10일
Thank you for your example. It is useful for my work.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Annotations에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by