stacked plot of subplots that includes three graphs
2 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
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 Commenti
Walter Roberson
il 21 Ott 2022
stackedplot([A(:), C(:), D(:)], [B(:), B(:), B(:)])
That sort of thing ?
Risposte (1)
Walter Roberson
il 21 Ott 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 Commenti
Walter Roberson
il 21 Ott 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.
Vedere anche
Categorie
Scopri di più su Subplots in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!