stacked plot of subplots that includes three graphs

조회 수: 2 (최근 30일)
Dharma Khatiwada
Dharma Khatiwada 2022년 10월 21일
댓글: Dharma Khatiwada 2022년 10월 21일
Hello,
I am trying to make a stacked plot of three subplots. For each subplot, I need to keep plots of three data vs time data.
A=load('Volume_15_400_M_R.txt');
B=load ('time_400.txt'); % time plot that needs to be in common x-axis
C=load('Volume_15_400_M_W_F.txt');
D=load('Volume_control.txt');
E=load('Volume_10_400_M_R.txt');
F=load('Volume_10_400_M_W_F.txt');
G=load('Volume_5_400_M_R.txt');
H=load('Volume_5_400_M_W_F.txt');
For subplot (3,1,1)
I am trying to keep A vs B, C vs B, and D vs B plots
For subplot (3,1,2)
I am trying to keep E vs B, F vs B, and D vs B plots
For subplot (3,1,3)
I am trying to keep G vs B, H vs B, and D vs B plots
Finally, I need to make stacked plot of above subplots.
Your suggestions will be highly appreciated.
Thanks
Dharma
  댓글 수: 2
Walter Roberson
Walter Roberson 2022년 10월 21일
stackedplot([A(:), C(:), D(:)], [B(:), B(:), B(:)])
That sort of thing ?
Dharma Khatiwada
Dharma Khatiwada 2022년 10월 21일
Thank you for the response. I am not exactly sure. But, trying to keep three plots in each subplot and stacking the subplots.
something like given figure. I am trying to keep just a single x axis value.

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

답변 (1개)

Walter Roberson
Walter Roberson 2022년 10월 21일
subplot(3,1,1)
plot(B, [A(:), C(:), D(:)]);
subplot(3,1,2)
plot(B, [E(:), F(:), D(:)]);
subplot(3,1,3)
plot(B, [G(:), H(:), D(:)]);
  댓글 수: 3
Walter Roberson
Walter Roberson 2022년 10월 21일
subplot(3,1,1)
plot(B, [A(:), C(:), D(:)]);
xticks([])
subplot(3,1,2)
plot(B, [E(:), F(:), D(:)]);
xticks([])
subplot(3,1,3)
plot(B, [G(:), H(:), D(:)]);
This will probably still not look exactly the way you would prefer.
The plot you posted as an exaple is produced by the stackedplot command. Unfortunately, that only permits a single line for each section. There are ways to get it to draw what look like multiple lines, but there is no supported method to get those lines in different colors.
If is possible to call stackedplot() and struct() the result (ignoring the warning), and then access the Axes property of that to get an N x 1 array of axes handles. You can then use those handles to draw additional lines. This is possible -- but it is not supported.
Dharma Khatiwada
Dharma Khatiwada 2022년 10월 21일
Thank you very much, Walter!
I truly appreciate your help. Yes, I am not getting what I was originally thinking but your ideas already helping me to bring my work in a good shape.

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

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by