フィルターのクリア

Title for a figure containing many pictures

5 ビュー (過去 30 日間)
Mohammed Qahosh
Mohammed Qahosh 2019 年 6 月 8 日
コメント済み: Mohammed Qahosh 2019 年 6 月 8 日
I am making a figure containing many pictures. I did that by using the subplot function.
I would like to add a title for the whole pictures. How could I do that?
Thanks in advance for your help.

採用された回答

Prasanth Sikakollu
Prasanth Sikakollu 2019 年 6 月 8 日
Use sgtitle() function to create a title for a figure containing subplots.
The following code creates 4 subplots with its respective titles and a title for the whole figure.
subplot(2,2,1)
title('First Subplot') % Titles for the respective subplots
subplot(2,2,2)
title('Second Subplot')
subplot(2,2,3)
title('Third Subplot')
subplot(2,2,4)
title('Fourth Subplot')
sgtitle('Subplot Grid Title') % The title for the whole figure
For more information regarding sgtitle function refer to the following link:
Hope this helps in solving your problem.
  3 件のコメント
Prasanth Sikakollu
Prasanth Sikakollu 2019 年 6 月 8 日
You can use suptitle() function if you have bioinformatics toolbox.
suptitle('your title here')
If you dont have bioinformatics toolbox, try the following way:
Create a new axes which takes up much of the figure. Then a title for this axes. Turning the axes Visible property 'off' will make the axes "disappear", but the title will inherit this property and you will need to turn the Visible property for the title back 'on'. The below code does that.
subplot(2,2,1)
title('First Subplot') % Titles for the respective subplots
subplot(2,2,2)
title('Second Subplot')
subplot(2,2,3)
title('Third Subplot')
subplot(2,2,4)
title('Fourth Subplot')
% Title for the entire figure
a = axes;
t1 = title('Global Title for the figure');
a.Visible = 'off'; % set(a,'Visible','off');
t1.Visible = 'on'; % set(t1,'Visible','on');
Hope this helps
Mohammed Qahosh
Mohammed Qahosh 2019 年 6 月 8 日
It works. Thank you very much for your help.

サインインしてコメントする。

その他の回答 (1 件)

Rik
Rik 2019 年 6 月 8 日
You can also use the suptitle function. I remember it as being a native Matlab function, but I couldn't find it in the doc. You can get the code here. The copyright text describes it as being a Mathworks made functions, so maybe my confusion has its source there.
  1 件のコメント
Mohammed Qahosh
Mohammed Qahosh 2019 年 6 月 8 日
Thank you Rik. The second code written by Prasanth Sikakollu works very well on Matlab 2013.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeTitle についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by