Reducing Whitespace for a 2x3 subplot

9 views (last 30 days)
Hans123
Hans123 on 25 Oct 2022
Commented: J. Alex Lee on 26 Oct 2022
I am trying to reduce the whitespace between a 2x3 grid of images.
I have tried subplot and tiledlayout--codes and images below--apparently to preserve scaling, the spacing and padding options for TiledLayout does not work.
I would greatly appreciate any pointers on reduce the white space between the 6 images (in a 2x3) plot
figure;
subplot(2, 3, 1);
imshow((An{1})); title('$A_{50}$',FontSize=16,Interpreter='latex')
subplot(2, 3, 2);
imshow((An{2})); title('$A_{100}$',FontSize=16,Interpreter='latex')
subplot(2, 3, 3);
imshow((An{3})); title('$A_{200}$',FontSize=16,Interpreter='latex')
subplot(2, 3, 4);
imshow((An{4})); title('$A_{300}$',FontSize=16,Interpreter='latex')
subplot(2, 3, 5);
imshow((An{5})); title('$A_{400}$',FontSize=16,Interpreter='latex')
subplot(2, 3, 6);
imshow((An{5})); title('Original',FontSize=16,Interpreter='latex')
sgtitle('The title',FontSize=16,Interpreter='latex')
figure;
tiledlayout(2,3,"TileSpacing","none",Padding="tight")
imshow((An{1})); title('$A_{50}$',FontSize=16,Interpreter='latex')
nexttile
imshow((An{2})); title('$A_{100}$',FontSize=16,Interpreter='latex')
nexttile
imshow((An{3})); title('$A_{200}$',FontSize=16,Interpreter='latex')
nexttile
imshow((An{4})); title('$A_{300}$',FontSize=16,Interpreter='latex')
nexttile
imshow((An{5})); title('$A_{400}$',FontSize=16,Interpreter='latex')
nexttile
imshow((A)); title('Original',FontSize=16,Interpreter='latex')
  2 Comments
dpb
dpb on 25 Oct 2022
Anything tighter than that obtained with the named parameters you'll have to create by either adjusting the axes 'Position' property after creation or create them manually from the git-go with axes
J. Alex Lee
J. Alex Lee on 26 Oct 2022
i think the issue is not with tiledlayout - in my experience "tight" is "really tight"...i think the issue is that since your tiles contain images, and imshow may be doing something independently to preserve aspect ratio and/or scale...for example, if you resize the figure and adjust its aspect ratio, do you find a point where the images fill up the space better?

Sign in to comment.

Answers (0)

Tags

Products


Release

R2022b

Community Treasure Hunt

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

Start Hunting!