tightly_SubPlot

Version 1.0.2 (1.36 KB) by yu shi
note : manual by user to adjust axis size and position of subplot to plot figure tightly
48 Downloads
Updated 23 Aug 2020

View License

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 (2024). tightly_SubPlot (https://www.mathworks.com/matlabcentral/fileexchange/79391-tightly_subplot), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2014a
Compatible with any release
Platform Compatibility
Windows macOS Linux
Acknowledgements

Inspired: Remove White Space,Make Subplot Tight

Community Treasure Hunt

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

Start Hunting!
Version Published Release Notes
1.0.2

some correct of note

1.0.1

new example figure

1.0.0