Very often, I see people with plotting tasks that can be accomplished with a nesting of tiled chart layouts, but the syntax required for this can seem somewhat acrobatic. I've therefore created this submission to simplify the creation of (outer) tiled layouts whose tiles contain smaller (inner) tiled layouts.
What it does is let you specify the dimensions and nesting structure of the layouts in advance. It will then set-up the layout with empty axes, adn return handles to the axes and to the inner and outer layouts.You can then just loop over the axes handles with either 1D or 4D indexing and populate the axes with their actual intended contents. Furthermore, the tiled layout handles provided by the code let you add shared elements like legends and axis labels.
Example: A 3x1 set of tiles each containing a 2x6 tiled layout
[ax,t,T]=nestedLayouts([3,1],[2,6]);
for i=1:numel(ax) %populate all 24 axes with plot data
plot(ax(i),rand(1,5));
end
for i=1:numel(t) %Give each outer tile its own ylabel
ylabel(t(i),"ylabel No. "+i);
end
sgtitle(T, "Tiled Layout") %Global Title
引用格式
Matt J (2024). Grids of tiled chart layouts (https://www.mathworks.com/matlabcentral/fileexchange/161736-grids-of-tiled-chart-layouts), MATLAB Central File Exchange. 检索时间: .
MATLAB 版本兼容性
创建方式
R2021b
兼容任何版本
平台兼容性
Windows macOS Linux标签
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!