How to add a title and logo to a figure with multiple plots?

조회 수: 19 (최근 30일)
Frits
Frits 2011년 3월 28일
댓글: Julius Albrecht 2016년 2월 2일
LS,
I have made a figure with four plots. Each of the plots have a title indicating what the plot shows. Is it possible to add a title above those four plots as a common title? And is it possible to add a picture (logo) next to the title? Help would be very much appreciated.
Best regards,
Frits Hermans

채택된 답변

Paulo Silva
Paulo Silva 2011년 3월 28일
clf
subplot(211)
plot(1,1,'*')
title('one')
subplot(212)
plot(2,2,'*')
title('two')
axh=get(gcf,'Children');
pause(2)
disp('figure created with two axes, each one with a diferent title')
disp('Now we are making both titles equal')
%this is where the magic happens
for a=1:numel(axh)
titleh=get(axh(a),'title');
set(titleh,'String','Now the axes have this title')
end
  댓글 수: 1
Julius Albrecht
Julius Albrecht 2016년 2월 2일
That is not a solution for the problem. He wants to add a title over all plots, not change all the specific titles at once.

댓글을 달려면 로그인하십시오.

추가 답변 (2개)

Andrew Newell
Andrew Newell 2011년 3월 28일
The title part is easy enough. Just download suplabel from the File Exchange.
EDIT: A crude way to add the logo is to select Insert -> Axes from the menu, put an axis box where you want it, then do the following:
logo = imread('logo.gif');
imshow(logo)
axes off
It may not look good, though, unless your logo is very simple. You could also create your main title using Insert -> TextBox.

Dave Welch
Dave Welch 2011년 4월 26일
Nice approach, but I don't think this is what Frits is asking. Suppose you have this code:
fHandle = figure;
hold on;
title( 'Main Title' );
for xx = 1:X
% Do some computations...
subHandle(xx) = subplot( 4, 1, xx);
title( char( sprintf( 'Subplot %d', xx ) ) );
end
The code runs fine, but the main title gets the kibosh from the subplots in the loop. I think the suplabel option is probably the best in this instance.
( Can't imagine why MATLAB hasn't addressed this issue yet. We're on what, R2010? )
  댓글 수: 2
Andrew Newell
Andrew Newell 2011년 4월 26일
Is this a comment on Paulo's answer? I have already suggested using suplabel.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Title에 대해 자세히 알아보기

제품

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by