Force tiledlayout('flow') to layout vertically
106 views (last 30 days)
The problem I have with tiledlayout('flow') is that it it will often end up arranging the plots in a 2x2 grid, rather than a 4x1.
I understand tiledlayout('flow') tries to keep a 4:3 ratio for plots, but this is not useful for my data.
Tiledlayout(x,1) won't work because I don't know x beforehand.
I had hoped that in the case of tiledlayout(x,1) I could set the GridSize property, but it is read only.
Any suggestions on how to overcome this would be helpful, thank you.
Dave B on 17 Mar 2023
Starting in R2023a you can use the 'horizontal' and 'vertical' tile arrangements to accomplish layouts that are dynamically sized but only in one direction. More information available in the tiledlayout documentation.
More Answers (1)
Srivardhan Gadila on 20 Aug 2020
Based on the above information and the documentation of tiledlayout & nexttile, for this particular problem you can make use of the 'nexttile(span)' syntax as follows:
% Let the max number tiles are maxTiles = 1000 (>>n or just >=n)
maxTiles = 1000;
x = linspace(0,30);
n = randi([1 10]);
y = rand(1,numel(x));