How can I change the fontface of a text within a plot

조회 수: 345 (최근 30일)
jjlivestrong
jjlivestrong 2012년 9월 30일
댓글: Image Analyst 2024년 1월 27일
Quick question, can I change the font face on MATLABs plot to other not being Arial (At least I think the default style is Arial).
If I were to change it to Times New Roman, what must I do?
Can you please help?
  댓글 수: 4
shumaila
shumaila 2024년 1월 27일
How can I adjust font as bold?
Image Analyst
Image Analyst 2024년 1월 27일
@shumaila did you try
set(gca, 'FontWeight', 'bold')

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

채택된 답변

Walter Roberson
Walter Roberson 2012년 9월 30일
편집: Walter Roberson 2018년 4월 7일
title() and *label() accept 'FontName' property/value pairs. You can also use a FontName property/value pair in an axes() call, or you can set() that.
Note that if you set() an axes fontname, then http://www.mathworks.com/help/matlab/ref/axes_props.html
"Note that MATLAB does not display the x-, y-, and z-axis labels in a new font until you manually reset them (by setting the XLabel, YLabel, and ZLabel properties or by using the xlabel, ylabel, or zlabel command). Tick mark labels change immediately."

추가 답변 (2개)

Matt Fig
Matt Fig 2012년 9월 30일
get(gca,'fontname') % shows you what you are using.
set(gca,'fontname','times') % Set it to times

Image Analyst
Image Analyst 2012년 9월 30일
편집: Image Analyst 2012년 9월 30일
For example:
text(.10,.2, 'Hello World', 'FontName', 'Impact', 'FontSize', 40, 'Color', [.5 0 1]);
Should work with title(), xlabel(), and ylabel() also.

카테고리

Help CenterFile Exchange에서 Axis Labels에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by