tiledlayout("vertical") with multiple columns

9 ビュー (過去 30 日間)
Andreas Tischler
Andreas Tischler 2025 年 9 月 12 日
コメント済み: Walter Roberson 2025 年 9 月 12 日
Hi,
I want to create a figure with a tiledlayout("vertical") meaning that new rows can be added with nexttile() at a later time. However this layout should have multiple columns per row (the number of columns stays the same in each row - however I do not know how many rows will be added in the end). Do you know of a way how this is possible?
I tried nesting layouts but that didn't work well - see following code:
ff = figure()
T=tiledlayout(ff, "vertical");
nexttile(T,[1,1]); axis off
t1=tiledlayout(T, "horizontal"); %first inner layout
nexttile(t1)
nexttile(t1)
nexttile(T); axis off
t2=tiledlayout(T, "horizontal"); %first inner layout
nexttile(t2)
Thanks a lot,
Andreas

回答 (1 件)

Star Strider
Star Strider 2025 年 9 月 12 日
I am not certain that tiledlayout can easily do what you want.
It might be easier to use subplot instead. That way, you can iteratively add rows and columns without knowing the number of subplots you may have initially.
  1 件のコメント
Walter Roberson
Walter Roberson 2025 年 9 月 12 日
subplot() lays out the position of the axes at the time subplot() is called. If you call subplot(1,2,1) to place on the right hand side of the first row, and you later expand to two rows and so call subplot(2,2,4) to place on the right hand side of the new second row... then the subplot(1,2,1) will partially underlay the calculated position of subplot(2,2,4), resulting in subplot() removing the old subplot(1,2,1) axes. subplot() will not move the existing plots.

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

カテゴリ

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

製品


リリース

R2025a

Community Treasure Hunt

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

Start Hunting!

Translated by