我正在使用子图命令绘制5 x 3个图,但是每个子图周围都有大量边距。

如何控制它们周围的边距大小?

figure;
for c=1:15
    subplot(5,3,c); 
    imagesc(reshape(image(:,c), 360,480)); 
    colormap gray; 
    axis image;
end

alt text

有帮助吗?

解决方案

问题是MATLAB分配了 position 每个轴的属性使每个图周围都有空间。您可以调整 position 财产,或者您可以得到 亚轴 从文件交换并按照您喜欢的方式设置子图。

其他提示

看看轴的 散乱的人外置 特性:http://undocumentedmatlab.com/blog/axes-looseinset-property/

由于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';
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top