我使用subplot命令绘制5 x 3的图,但每个子图周围都有大量的页边距。
我如何控制他们周围的边距大小?
figure;
for c=1:15
subplot(5,3,c);
imagesc(reshape(image(:,c), 360,480));
colormap gray;
axis image;
end
发布于 2010-12-11 00:26:56
问题是,Matlab会分配每个轴的position
属性,以便每个图周围都有空间。您可以调整position
属性,也可以从文件交换中获取subaxis并以您喜欢的方式设置子图。
发布于 2010-12-12 00:37:32
查看axes的LooseInset和OuterPosition属性:http://undocumentedmatlab.com/blog/axes-looseinset-property/
发布于 2019-09-17 16:51:22
由于MATLAB的R2019b,你可以使用tiledlayout函数来控制子图的间距。
下面是一个例子,展示了如何在没有瓦片间距的情况下获得子图:
figure
example_image = imread('cameraman.tif');
t = tiledlayout(5,3);
nexttile
for c= 1:15
imagesc(example_image(:,c))
if c < 15
nexttile
end
end
t.TileSpacing = 'None';
https://stackoverflow.com/questions/4410873
复制相似问题