How can I change the font size of plot tick labels?
3,224 views (last 30 days)
Show older comments
Gene Polovy on 31 Jan 2015
Commented: Zong-Jhen Ye on 10 Oct 2022
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.)
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;
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.
More Answers (2)
Zaid hamamah on 25 Apr 2022
I know it is too late but just for the future readers: (i am using version R2021a)
1) To change the font size of all texts included of (ax) axes, such as y- and x- axes labels in addition to the title or any other text like tick labels:
2) To change all the text attached to one specific axis: (tick labels and label)
3) To change only the size of the label:
The same goes for y-axis using:
So if you want to change the tick labels, you can use a general command like the second one, and then readjust the label specifically using the third command.
Marzena Krzek -BIO- on 17 Aug 2019
i have 2019b - it doesn't work for me either
Yijun Li on 26 Feb 2021
same problem. I am using 2019a Windows, gca.YAxis.FontSize = 40 does not change the tick font
Find more on Axis Labels in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!