フィルターのクリア

How to combine two plots, each with multiple plots

1 回表示 (過去 30 日間)
John Kim
John Kim 2022 年 3 月 19 日
コメント済み: Voss 2022 年 3 月 20 日
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
  2 件のコメント
John Kim
John Kim 2022 年 3 月 20 日
Thanks so much! Works like a charm!
Voss
Voss 2022 年 3 月 20 日
You're welcome!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeGraphics Objects についてさらに検索

製品


リリース

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by