Why does the tiledlayout keep the whitespace between tiles although TileSpacing is 'tight'
39 views (last 30 days)
Show older comments
dear community,
i have a tiledlayout with TileSpacing set to 'tight', but the upper row keeps space below it, altough there is noting to keep space for. there is also no whitespace title in row 2 or something like that. Any idea? I am on 2022a.
fig=openfig('spaceBetweenTilesNotClosing.fig');
annotation("rectangle",'Position',[0.0563,0.629,0.9115,0.09708],'Color','g');
tl=findall(fig,'type','tiledlayout');
tl
2 Comments
Stephen23
on 13 May 2024
"Any idea?"
The TILEDLAYOUT documentation does not show or describe that the TILESPACING="TIGHT" option wil remove all whitespace. What specific part of the documentation makes you think that it should?
Perhaps you were thinking of the "NONE" option, which does remove all whitespace from between the axes.
Accepted Answer
Voss
on 13 May 2024
I guess the "tiled" part of "tiledlayout" implies that all contained axes are the same size and that the amount of space between adjacent axes is the same. So even though nothing needs to go in the space between the top row of axes and the second row, the space needs to be there since there is stuff (xlabels and xticklabels) that goes underneath the axes in the other rows.
1 Comment
Voss
on 13 May 2024
Original - constant space between rows of axes:
fig=openfig('spaceBetweenTilesNotClosing.fig');
With xticklabels and xlabels set to empty, there is a smaller constant space between rows of axes:
fig=openfig('spaceBetweenTilesNotClosing.fig');
tl=findall(fig,'type','tiledlayout');
ax = tl.Children;
t = get(ax,'XLabel');
set([t{:}],'String','');
set(ax,'XTickLabel',{})
With no xlabels and only one axes having xticklabels, there is still constant space between rows of axes, just enough to accommodate the tick labels:
fig=openfig('spaceBetweenTilesNotClosing.fig');
tl=findall(fig,'type','tiledlayout');
ax = tl.Children;
t = get(ax,'XLabel');
set([t{:}],'String','');
set(ax,'XTickLabel',{})
set(ax(4),'XTickLabelMode','auto')
With no xticklabels and only one axes having an xlabel, there is still constant space between rows of axes, just enough to accommodate the xlabel:
fig=openfig('spaceBetweenTilesNotClosing.fig');
tl=findall(fig,'type','tiledlayout');
ax = tl.Children;
t = get(ax,'XLabel');
set([t{:}],'String','');
t{5}.String = 'Lab^e_l';
set(ax,'XTickLabel',{})
In all cases, the space between rows is the same and is just enough to accommodate what's needed.
More Answers (0)
See Also
Categories
Find more on 2-D and 3-D Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!