subplotHelper

版本 2.0 (4.4 KB) 作者: Frederick Zittrell
Helps with organizing and referring to SUBPLOT axes with an interactive grid tile chooser.
91.0 次下载
更新时间 2020/7/23

查看许可证

编者注: This file was selected as MATLAB Central Pick of the Week

This simple class helps with using SUBPLOT(M, N, P) by showing the SUBPLOT grid
that will be created. The user can interactively choose the grid tiles that should
be used for each axes by brushing the displayed rectangles. The property 'p' then
holds a two-column matrix where each row is the P-input to each axes in the
SUBPLOT for the respective grid part.

Example:

% 1) open the GUI
m = 4; % rows
n = 6; % columns
sbh = subplotHelper(m, n); % open grid tile chooser

% 2) Interactively choose which tiles should be used for subplots

% 3) Retrieve the subplot arrangement matrix:
% Either by copying it to the clipboard (via the button in the GUI) or by calling this:
p = sbh.p;

%% Workflow for subplot arrangement:

% 1) Define subplot dimensions
m = 4; % rows
n = 6; % columns
sbh = subplotHelper(m, n); % open grid tile chooser, choose layout
p = sbh.p; % get subplot arrangement matrix

% 2) Use the matrix for your subplot
x = -5:0.1:5;
for iP = 1:size(p, 1)
ax = subplot(m, n, p(iP, :));
plot(ax, x, sin(x)+randn(size(x)));
end

% 3) Optional: Adjust subplot layout
% show layout again and adjust the tile arrangement using the GUI table
sbh = subplotHelper.showP(m, n, p);
p = sbh.p;
% Then go back to step 2, applying the adjusted layout

引用格式

Frederick Zittrell (2025). subplotHelper (https://www.mathworks.com/matlabcentral/fileexchange/71369-subplothelper), MATLAB Central File Exchange. 检索时间: .

MATLAB 版本兼容性
创建方式 R2020a
与 R2017a 及更高版本兼容
平台兼容性
Windows macOS Linux
类别
Help CenterMATLAB Answers 中查找有关 Subplots 的更多信息

Community Treasure Hunt

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

Start Hunting!
版本 已发布 发行说明
2.0

Add GUI elements that permit convenient adjustment of the chosen grid arrangement.
Add static method 'showP' that allows for displaying and adjusting a previously defined subplot grid.

1.0.1

Update required MATLAB version

1.0.0