title that spans subplots

5 ビュー (過去 30 日間)
Stewart Wiseman
Stewart Wiseman 2011 年 8 月 12 日
回答済み: Steven Lord 2018 年 10 月 23 日
Hi, I am a newbie. How can I add a title so that it spans across two graphs plotted with subplot? (I can add titles to individual plots and even add a title to a figure window but neither of these is what I want). Thanks

採用された回答

Patrick Kalita
Patrick Kalita 2011 年 8 月 12 日
An annotation is good to use here. It is a little easier than the text command because the position is relative to the figure -- not one of the axes. Here's an example:
subplot(1,2,1), plot(1:10)
subplot(1,2,2), plot(1:10)
annotation('textbox', [0 0.9 1 0.1], ...
'String', 'hello, title', ...
'EdgeColor', 'none', ...
'HorizontalAlignment', 'center')
If this is just a one-off thing, you can also add an annotation interactively. That is described here in the documentation.

その他の回答 (4 件)

Sean de Wolski
Sean de Wolski 2011 年 8 月 12 日
How about with super title!
doc suptitle
What it looks like:
  3 件のコメント
Sean de Wolski
Sean de Wolski 2011 年 8 月 12 日
Oh. I thought it was standard.
It's in the Bio toolbox as part of a yeast infection demo.
*A word may have been inserted for humor's sake.
Stewart Wiseman
Stewart Wiseman 2011 年 8 月 13 日
A super title is entirely logical, but didn't work on my version. :(

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


Steven Lord
Steven Lord 2018 年 10 月 23 日
If you're using release R2018b or later, use sgtitle.

the cyclist
the cyclist 2011 年 8 月 12 日
One way to do this is with the text() command:
>> subplot(1,2,1), plot(1:10)
>> subplot(1,2,2), plot(1:10)
>> text(-10,10.2,'Test title spanning two subplots -- Some fine tuning will be required')
>>
In this case, the text positioning is relatively to the second axes.

Shahzad ali Zardari
Shahzad ali Zardari 2018 年 10 月 23 日
if true
% code
end

カテゴリ

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