How can I insert a title over a group of subplots?
이전 댓글 표시
I would like to place a title over a group of subplots. How can I do this?
채택된 답변
추가 답변 (5개)
juanjaimesco
2016년 12월 15일
Suptitle does the job
x=1:0.01:10;
subplot(2,2,1); plot(sin(x))
subplot(2,2,2); plot(cos(x))
subplot(2,2,3); plot(cos(x.^2))
subplot(2,2,4); plot(sin(x.^2))
suptitle('I am a super title')
Paul Huxel
2018년 10월 9일
17 개 추천
Starting in R2018b, you can use sgtitle to add a title to subplot grids:
Bradley Stiritz
2018년 9월 9일
1 개 추천
>Answer by MathWorks Support Team on 26 Apr 2010
>It is not possible to put a title over a group of subplots in MATLAB..
With respect, this is not a helpful comment, as it's apparently not true. It is possible, just not with built-in core Matlab functionality. Most people will hopefully continue reading the thread, and learn about the workarounds. Still, it's not an encouraging or precise statement to begin the group discussion, IMHO.
댓글 수: 2
ANKUR KUMAR
2018년 9월 10일
There is a function suptitle which may does our work. It puts perfectly the title over all subplots.
Cris LaPierre
2018년 10월 25일
FYI: suptitle is only available to those who have the Bioinformatics toolbox, and then it was included in a demo file and is not an actual MathWorks maintained function.
However, as Paul Huxel points out, there is now (r2018b) a function in base MATLAB for this. It is called sgtitle.
Eric Sargent
2020년 12월 9일
편집: Eric Sargent
2020년 12월 9일
Starting in R2019b, you can also use tiledlayout and nexttile instead of subplot, which has shared titles and labels. You can use the title, xlabel, and ylabel commands directly with tiledlayouts:
tl = tiledlayout(3,3);
for i = 1:9
nexttile(tl)
plot(rand(5,1));
end
title(tl,'Layout Title');
xlabel(tl,'Layout XLabel');
ylabel(tl,'Layout YLabel');
Gouater Loic
2020년 10월 6일
0 개 추천
This video clearly explains that https://www.youtube.com/watch?v=VX-vPvcqoSw
카테고리
도움말 센터 및 File Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!