필터 지우기
필터 지우기

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 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