How can I change the font size of the current axis?

조회 수: 2,636(최근 30일)
Hassan 2011년 6월 15일
답변: Image Analyst 2022년 5월 16일
How can I change the font size of the axes of the current graph without creating new axes? For example, if we have this plot already, how can I change the font size?
x = rand(10,10);
y = rand(10,10);

채택된 답변

Matt Fig
Matt Fig 2022년 4월 28일
편집: MathWorks Support Team 2022년 4월 28일
To change the font size, set the FontSize property on the axes object after plotting. For example:
x = rand(10,10);
y = rand(10,10);
Starting in R2022a, you can use the “fontsize” function to change the font size for any graphics object that has text associated with it. In this case, pass the axes object to the “fontsize” function followed by the desired font size in points. For example:
You can also change the font name using the “fontname” function. The font you specify must be installed on your system. For example, change the font of the current axes to Courier:
  댓글 수: 3
Viktor Erdelyi
Viktor Erdelyi 2022년 5월 16일
On my end, I had to specify the fontsize unit as shown here.

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

추가 답변(1개)

Image Analyst
Image Analyst 2022년 5월 16일
See attached demo to see how you can independently change a wide variety of things in your axes.

Community Treasure Hunt

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

Start Hunting!

Translated by