フィルターのクリア

Adding existing axes objects to a new tiledlayout

57 ビュー (過去 30 日間)
Christoph Schmidt
Christoph Schmidt 2020 年 10 月 19 日
コメント済み: Karl_469 2023 年 11 月 2 日
I have a cell-array of axes-objects which all have different parents. Now I would like to transfer all those objects to the same tiledlayout. I tried changing their parents one-by-one, but then they all appear in the same tile:
f = figure();
t = tiledlayout(3,3);
for i = 1:9
set(arrayOfAxes{i}, 'Parent', t);
end
I also tried using nexttile() in the for loop, but this didn't help. Is there a way to specify which tile an axes-object belongs to within tiledlayout?
Appreciate you help very much!

採用された回答

Reshma Nerella
Reshma Nerella 2020 年 10 月 29 日
編集済み: Reshma Nerella 2020 年 10 月 29 日
Hi Christoph,
set(arrayOfAxes{i}, 'Parent', t); % axes object can not be a child of t(tiledlayout)
Each tile in 'tiledlayout' contains an axes, you can plot directly without creating axes in the layout. Once you plot something, you can use 'nexttile' to plot on the next tile.
In case you want a layout with axes in all the tiles, you can create a grid layout manager, it creates an invisible grid and positions components(like axes) along the rows and columns of the grid.
For more information and examples, refer to the documentation pages tiledlayout, nexttile and uigridlayout
  2 件のコメント
Christoph Schmidt
Christoph Schmidt 2020 年 10 月 29 日
Thanks a lot for your help!
Karl_469
Karl_469 2023 年 11 月 2 日
In case you end up overlaying all figures in one tile, rather then having a tile for each axis/"figure" use
Eric Sargent's approach:
https://ch.mathworks.com/matlabcentral/answers/101806-how-can-i-insert-my-matlab-figure-fig-files-into-multiple-subplots#comment_1195904

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

その他の回答 (1 件)

Tim Baur
Tim Baur 2021 年 12 月 13 日

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by