tiledlayout("vertical") with multiple columns

조회 수: 7 (최근 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 CenterFile Exchange에서 Subplots에 대해 자세히 알아보기

제품


릴리스

R2025a

Community Treasure Hunt

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

Start Hunting!

Translated by