stacked plot of subplots that includes three graphs

3 Ansichten (letzte 30 Tage)
Dharma Khatiwada
Dharma Khatiwada am 21 Okt. 2022
Kommentiert: Dharma Khatiwada am 21 Okt. 2022
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 Kommentare
Walter Roberson
Walter Roberson am 21 Okt. 2022
stackedplot([A(:), C(:), D(:)], [B(:), B(:), B(:)])
That sort of thing ?
Dharma Khatiwada
Dharma Khatiwada am 21 Okt. 2022
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.

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Walter Roberson
Walter Roberson am 21 Okt. 2022
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 Kommentare
Walter Roberson
Walter Roberson am 21 Okt. 2022
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 am 21 Okt. 2022
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.

Melden Sie sich an, um zu kommentieren.

Community Treasure Hunt

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

Start Hunting!

Translated by