如何减少matlab中子图的边界?

Joh*_*ohn 45 matlab subplot

可能重复:
MATLAB子图边距

在matlab中,在子图周围浪费了过多的空间.例如,在此示例中:

t = 0:0.001:2*pi+0.001;
figure(2);
for i = 1 : 25;
    subplot(5,5,i);
    plot(t, sin(i*t));
    axis off
end
Run Code Online (Sandbox Code Playgroud)

子图中浪费的白色空间的示例

图中超过50%的空间被浪费为"空白"我想缩小空白区域,但是找不到这样做的机制是不成功的.思考?

谢谢约翰

nib*_*bot 48

subaxis对文件交换功能,允许您为次要情节指定页边距.

用法示例:

t = 0:0.001:2*pi+0.001;
figure(2);
for i = 1 : 25;
    subaxis(5,5,i, 'Spacing', 0.03, 'Padding', 0, 'Margin', 0);
    plot(t, sin(i*t));
    axis tight
    axis off
end
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述


Nic*_*old 6

您可以使用自己(或以编程方式)定位它们

subplot('Position',[left bottom width height]);
Run Code Online (Sandbox Code Playgroud)

默认情况下,坐标是标准化的.因此,[0.1 0.1 0.5 0.5]的位置将从左下角的10%开始,宽度等于图形宽度的一半,高度等于图形高度的一半.

有关边距和填充的内置解决方案,请参阅已接受的答案.


Yai*_*man 5

尝试减少隐藏轴LooseInsets属性中的默认值,如http://UndocumentedMatlab.com/blog/axes-looseinset-property/中所述

例如:

set(gca, 'LooseInset', get(gca,'TightInset'))
Run Code Online (Sandbox Code Playgroud)