MATLAB Answers

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

조회 수: 3,078(최근 30일)
Gene Polovy
Gene Polovy 2015년 1월 31일
댓글: Yijun Li 2021년 2월 26일
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
Star Strider 2015년 1월 31일
편집: MathWorks Support Team 2018년 11월 27일
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)
  댓글 수: 3
Image Analyst
Image Analyst 2015년 1월 31일
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.

댓글을 달려면 로그인하십시오.

추가 답변(1개)

Marzena Krzek -BIO-
Marzena Krzek -BIO- 2019년 8월 17일
i have 2019b - it doesn't work for me either
  댓글 수: 5
Yijun Li
Yijun Li 2021년 2월 26일
same problem. I am using 2019a Windows, gca.YAxis.FontSize = 40 does not change the tick font

댓글을 달려면 로그인하십시오.

Community Treasure Hunt

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

Start Hunting!

Translated by