function tightly_SubPlot(m,n,scale,edge,name,type)
% m as row num
% n as col num
% scale as axis size of each subplot, use to adjust distance between subplot
% edge as the distance from the coordinate axis from subplot [m row,1st col] to the
% lower and left
% name use for save figure
% type as formate of figure
% ShiYu 2020-8-21
% note : manual by user to adjust axis size and position of subplot
if nargin == 5
type = 'pdf';
elseif nargin == 4
type = 'pdf';
name='sample';
elseif nargin == 3
type = 'pdf';
name='sample';
edge=0.05;
elseif nargin == 2
type = 'pdf';
name='sample';
edge=0.05;
scale=0.7;
end
figure('Color',[1 1 1]);
X_length=1-edge;
Y_length=1-edge;
xsize=X_length/n;
ysize=Y_length/m;
for x=1:m
for y=1:n
h=axes('Position',[xsize*(y-1)+edge 1-ysize*x scale*xsize scale*ysize]);
end
end
saveas(gca,name,type);
end
引用格式
yu shi (2026). tightly_SubPlot (https://ww2.mathworks.cn/matlabcentral/fileexchange/79391-tightly_subplot), MATLAB Central File Exchange. 检索时间: .
MATLAB 版本兼容性
平台兼容性
Windows macOS Linux标签
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!