You are now following this Submission
- You will see updates in your followed content feed
- You may receive emails, depending on your communication preferences
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
Cite As
yu shi (2026). tightly_SubPlot (https://www.mathworks.com/matlabcentral/fileexchange/79391-tightly_subplot), MATLAB Central File Exchange. Retrieved .
Acknowledgements
Inspired: Remove White Space,Make Subplot Tight
General Information
- Version 1.0.2 (1.36 KB)
MATLAB Release Compatibility
- Compatible with any release
Platform Compatibility
- Windows
- macOS
- Linux
