Reducing Whitespace for a 2x3 subplot
조회 수: 4 (최근 30일)
이전 댓글 표시
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')
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1168533/image.png)
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')
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1168538/image.png)
댓글 수: 2
dpb
2022년 10월 25일
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
2022년 10월 26일
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?
답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Subplots에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!