How can I use the command 'tiledlayout' inside a loop
30 ビュー (過去 30 日間)
古いコメントを表示
How I can I use 'tiledlayout' if I need to plot two graphs with each one has multiple graphs? I was using subplot but the white space area is too much. Is there any other command for this? I also need to generate PDF finally.
0 件のコメント
採用された回答
the cyclist
2022 年 5 月 12 日
The key is to create two different figures, each of which you can build up a tiled layout.
Here is a trivial example of two figures, each of which has three tiles:
rng default
numberFigures = 2;
fig_handles = zeros(numberFigures,1);
for nf = 1:numberFigures
fig_handles(nf) = figure;
tiledlayout(3,1);
nexttile
plot(rand(5))
nexttile
plot(rand(7))
nexttile
plot(rand(11))
end
2 件のコメント
the cyclist
2022 年 5 月 15 日
Here is an example, based on my other code, that writes two figures to PDF, where each figure is a tiled layout of four plots.
rng default
numberFigures = 2;
numberTiles = 4;
fig_handles = zeros(numberFigures,1);
for nf = 1:numberFigures
fig_handles(nf) = figure;
t = tiledlayout(numberTiles,1);
for nt = 1:numberTiles
nexttile
plot(rand(5)) % This is just an example. Use your simulation to make the plot.
end
exportgraphics(t,'myplots.pdf','Append',true)
end
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Lighting, Transparency, and Shading についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!