How do I make the graph title smaller in MATLAB R2014b?

2 views (last 30 days)
I am creating plots in MATLAB R2014b and I notice that the font for the title is bold and has a larger size compared to the font used for titles in MATLAB R2014a. Why is this so and how can I reduce the size of the font in the title?

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 25 Aug 2014
Starting in R2014b, MATLAB® graphics titles use a bold and slightly larger font for better visibility. As a result, some text might not fit within the extents of the figure window. For example, this code creates a graph that has a long title that does not fit within the extents of the figure window.
plot(1:10);
title('This is a title that is too long and does not fit within the extents of the figure window.')
 
The title font size is based on the 'TitleFontSizeMultiplier' and 'FontSize' properties of the axes. By default the 'FontSize' property is 10 points and the 'TitleFontSizeMultiplier' is 1.100, which means that the title font size is 11 points.
To change the title font size without affecting the rest of the font in the axes, set the 'TitleFontSizeMultiplier' property of the axes.
plot(1:10);
title('This is a title that is too long and does not fit within the extents of the figure window.')
ax = gca;
ax.TitleFontSizeMultiplier = 1;
<<http://www.mathworks.com/matlabcentral/answers/uploaded_files/19106/6fc47e1629b74cae435898f51eb9c312.png>>
To make the font size smaller for the entire axes, set the 'FontSize' property. Changing this property affects the font for the title, tick labels and axis labels, if they exist.
plot(1:10);
title('This is a title that is too long and does not fit within the extents of the figure window.')
ax = gca;
ax.FontSize = 8;
<<http://www.mathworks.com/matlabcentral/answers/uploaded_files/19107/9b9f4c9e756e35169a0eaca36d000e0a.png>>
 
To keep the same font size and display the title across two lines, use a cell array to define a multiline title.
plot(1:10);
title({'This is a title that is too long and does not fit', 'within the extents of the figure window.'})
 

More Answers (0)

Categories

Find more on Labels and Annotations in Help Center and File Exchange

Products


Release

R2014b

Community Treasure Hunt

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

Start Hunting!