MATLAB Answers

How can I change the font size of plot tick labels?

3,255 views (last 30 days)
I am trying to change the font size of the tick labels (the numbers) in my plots. (Just to be clear, I am NOT referring to the axis labels.)


Sign in to comment.

Accepted Answer

Star Strider
Star Strider on 31 Jan 2015
Edited: MathWorks Support Team on 27 Nov 2018
You can change the font size of the tick labels by setting the FontSize property of the Axes object. The FontSize property affects the tick labels and any axis labels. If you want the axis labels to be a different size than the tick labels, then create the axis labels after setting the font size for the rest of the axes text.
For example, access the current Axes object using the gca function. Use dot notation to set the FontSize property for the Axes object. Then create an x-axis label with a different font size.
x = rand(1,100);
y = rand(1,100);
ax = gca;
ax.FontSize = 16;
xlabel('My Label','FontSize',10)


Gene Polovy
Gene Polovy on 31 Jan 2015
I tried this using R2014a first and it didn't work, but I happen to have 2014b on another computer (my department recently upgraded) and it worked there. Thank you! I hope MATLAB looks into this issue ...
Star Strider
Star Strider on 31 Jan 2015
My pleasure! I’m glad it worked. There are version differences, so hanging out on Answers means the Questions are always something of a moving target.
(The most sincere expression of appreciation here on MATLAB Answers is to Accept the Answer that most closely solves your problem.)
Image Analyst
Image Analyst on 31 Jan 2015
If what you say is true, then they have looked into it. It's fixed in the new version isn't it? You said it was.

Sign in to comment.

More Answers (1)

Marzena Krzek -BIO-
Marzena Krzek -BIO- on 17 Aug 2019
i have 2019b - it doesn't work for me either


David Slater
David Slater on 29 May 2020
I have 2020a and it doesn't work in that version either.
Boris Touvykine
Boris Touvykine on 28 Jul 2020
This should work for 2019 & 2020
x = rand(1,100);
y = rand(1,100);
ax = gca;
ax.YAxis.FontSize = 13 %for y-axis
In general if you want to see what properties are there for axis appearences just run
and then click on "show all propeties" in command window.

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!