【发布时间】:2016-07-24 20:28:45
【问题描述】:
我正在尝试为多个子图使用一个超级标题。我使用annotation 来实现这一点。 annotation 在循环内。问题是annotation 在非动态时工作正常,但不幸的是,当我使用Loop 时我需要更改标题
我使用了以下代码,该代码在标题没有更改时有效。 (这只是随机数的一个例子)
clc;
clear;
a=rand(10,10);
for i=1:3
h(1)=subplot (2,2,1);
plot (a(:,1),a(:,2));
set(h(1),'Position',[.1 .35 .35 .5])
h(2)=subplot (2,2,2);
plot (a(:,1),a(:,2));
set(h(2),'Position',[.55 .35 .35 .5])
annotation('textbox', [0 0.85 1 0.1],'String',...
'Test text Number=1','EdgeColor', 'none','HorizontalAlignment', 'center')
end
我尝试如下更改annotation 行,但它不起作用
annotation('textbox', [0 0.85 1 0.1],'String',...
'Test text Number=%d',i,'EdgeColor', 'none','HorizontalAlignment', 'center')
我不想在我的代码中使用外部函数,例如 (suptitle,suplabel..etc)
【问题讨论】:
标签: matlab plot matlab-figure subplot