MATLAB Answers

graph subtitle?

509 views (last 30 days)
tombola on 12 Dec 2011
Answered: Adam Danz on 22 Sep 2020
Hi, is there a way to add a subtitle to a graph / plot?
So, for example the graph has a title above it like "UK Yield", then underneath it a subtitle "Data from ...somecompany...".
I keep seeing references to a subtitle.m on the file exchange but when I click the link the file is no longer available.
Thanks for any help,
[EDITED, Jan Simon]
Is there any way to get the 'Data from...' title underneath the graph. Like a small subtitle?

  1 Comment

Jan on 12 Dec 2011
Copied from Answers section:
Daniel wrote: Can you draw a figure that shows what you mean?

Sign in to comment.

Answers (2)

Daniel Shub
Daniel Shub on 12 Dec 2011
title({'UK Yield', 'Data from ...somecompany...'})
or maybe
title('UK Yield')
xlabel('Data from ...somecompany...')


Sign in to comment.

Adam Danz
Adam Danz on 22 Sep 2020
Starting in r2020b, you can add a title and subtitle using
t = title('myTitle');
s = subtitle('mySubtitle');
Alternatives prior to r2020b:
h = subplot(1,2,1);
formattedText = {'\fontsize{12}\color{black}\bfTitle1'; '\fontsize{8}\color{gray}\rmTitle2'};
% _______ _______
% title subtitle
h = title(h, formattedText);
% or more simply
h = subplot(1,2,2);


Sign in to comment.



Community Treasure Hunt

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

Start Hunting!