【发布时间】:2013-07-29 15:39:48
【问题描述】:
这里给出了一个子图的例子:
http://www.mathworks.com/support/solutions/en/data/1-16BSF/?product=SL&solution=1-16BSF
figure(1)
surf(peaks(10))
colorbar
figure(2)
mesh(peaks(10))
colorbar
figure(3)
contour(peaks(10))
colorbar
figure(4)
pcolor(peaks(10))
colorbar
% Now create destination graph
figure(5)
ax = zeros(4,1);
for i = 1:4
ax(i)=subplot(4,1,i);
end
% Now copy contents of each figure over to destination figure
% Modify position of each axes as it is transferred
for i = 1:4
figure(i)
h = get(gcf,'Children');
newh = copyobj(h,5)
for j = 1:length(newh)
posnewh = get(newh(j),'Position');
possub = get(ax(i),'Position');
set(newh(j),'Position',...
[posnewh(1) possub(2) posnewh(3) possub(4)])
end
delete(ax(i));
end
figure(5)
如何在本例中为子图添加标签?只需添加“图 1”“图 2”等即可。
【问题讨论】:
-
您要添加什么样的标签?
-
在我的应用程序中,我正在创建一组文件内容的直方图,并希望用文件名标记每个直方图,即
'CFZ12'