如何给出子图的组合标题?

Sar*_*ama 4 matlab plot subplot matlab-figure

我想给我的子情节提供一个组合标题,而不是单独标题每个情节.例如;

for pl=1:4
      subplot(2,2,pl)
      title('Test') 
end
Run Code Online (Sandbox Code Playgroud)

给我这个:在此输入图像描述

如果我用这个:

figure
title('Test') 
for pl=1:4
      subplot(2,2,pl)

end
Run Code Online (Sandbox Code Playgroud)

我没有得到任何头衔.

我希望我的输出如下:在此输入图像描述

Ama*_*mal 7

有一个小技巧.您可以执行以下操作以生成具有多个子图的图形.

h = figure 
for pl=1:4
    subplot(2,2,pl)
end
Run Code Online (Sandbox Code Playgroud)

在此之后,您必须将NextPlot属性设置为'add'.做这个:

h.NextPlot = 'add';
a = axes; 

%// Set the title and get the handle to it
ht = title('Test');

%// Turn the visibility of the axes off
a.Visible = 'off';

%// Turn the visibility of the title on
ht.Visible = 'on';
Run Code Online (Sandbox Code Playgroud)

希望这可以帮助!

  • 因为您已经定义了图形的句柄.你应该使用它.使用h.Name ='有限地平线'.如果你再次使用数字,当然它会打开另一个数字窗口. (2认同)