MATLAB Answers

How do I change the font size of text in a figure?

1,181 views (last 30 days)
I want to change the font size for the title, axis labels, and other text in my figure. How do I do this?

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 27 Feb 2020
To change the font size, set the “FontSize” property for the axes. Since many plotting functions reset axes properties, including the font size, set the "FontSize" property after plotting.
For example, the code below sets the font size to 16 points. The tick labels use the specified font size. The title and axis labels use a slightly larger font size.
title('My title')
xlabel('My label')
ax = gca;
ax.FontSize = 16;
Alternatively, if you want more individual control over the font size, you can specify the “FontSize” property as name-value pair to the “title” and “xlabel” functions, as in the example below.
title('My title','FontSize',16)
xlabel('My label','FontSize',10)

More Answers (0)


No tags entered yet.




Community Treasure Hunt

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

Start Hunting!