How to combine two plots, each with multiple plots

1 次查看(过去 30 天)
Hello, suppose I have time series plots, for example, sales growth and stock returns for nine industries.
I want to create a figure where Panel A would be 3 x 3 tiledlayout of sales growth for each of the nine industries, Panel B would be 3 x 3 tiledlayout of stock returns for each of the nine industries.
One way would be to create 6 x 3 tiledlayout, but I'm curious if there is a way for me to create these figures separately, and then reapply tiledlayout. For example, a pseudo-code I'd ideally want is something like:
CY = Sales_growth; % Sales_growth is a 9 x 1 cell, each with time series.
tiledlayout(3,3)
for cat = 1:NIndustry
nexttile
plot(CY{industry},'blue','LineWidth',2)
title(Industry_Name{cat}) % Industry_Name is a 9 x 1 cell, each with the name of the industry
end
Do something like "save figure as Panel A"
CY = Stock_returns; % Stock_returns is a 9 x 1 cell, each with time series.
tiledlayout(3,3)
for cat = 1:NIndustry
nexttile
plot(CY{industry},'blue','LineWidth',2)
title(Industry_Name{cat}) % Industry_Name is a 9 x 1 cell, each with the name of the industry
end
Do something like "save figure as Panel B"
At this point, do something like
tiledlayout(2,1)
nextile
Panel_A
title('Panel A: Sales Growth')
nexttile
Panel_B
title('Panel A: Stock Returns')
I would really really appreciate any and all advice, comments, and helps! Thanks so much for your time.

采纳的回答

Voss
Voss 2022-3-19
figure()
p1 = uipanel('Title','Sales Growth','Position',[0 0.5 1 0.5]);
t1 = tiledlayout(p1,3,3);
for i = 1:9
nexttile(t1);
plot(1:10);
end
p2 = uipanel('Title','Stock Returns','Position',[0 0 1 0.5]);
t2 = tiledlayout(p2,3,3);
for i = 1:9
nexttile(t2);
plot(1:10);
end

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Graphics Objects 的更多信息

产品


版本

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by