How to set default font size and style?

조회 수: 650 (최근 30일)
K E
K E 2015년 5월 12일
답변: Mayra 2021년 6월 30일
In R2015a, how do I set the default text for plot titles, ticklabels, and axes labels to 12 point normal font?

채택된 답변

Star Strider
Star Strider 2015년 5월 12일
I didn’t test this because I don’ want to change my installation or current property values, but see the documentation for Default Property Values.
Specifically, see if:
set(groot,'defaultFontName','Parchment')
or to some font more to your liking does what you want.
  댓글 수: 3
Star Strider
Star Strider 2015년 5월 13일
The get function can have an output argument, so that could have made things easier.
Peter Harrington
Peter Harrington 2019년 2월 5일
does not work in MATLAB 2018
set(groot,'defaultFontName','Verdana')
Error using matlab.ui.Root/set
fontname is an invalid class name

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

추가 답변 (2개)

Timothy Dalrymple
Timothy Dalrymple 2020년 6월 10일
편집: Timothy Dalrymple 2020년 6월 10일
I can't promise that his works in all cases, but I include this line at the top of my code and it sets all plots in my code.
So, I just skip the use of graphics root object (groot) set(groot,'defaultFontName','Verdana')
set(0, 'DefaultAxesFontSize', 18);

Mayra
Mayra 2021년 6월 30일
You should use:
set(groot,'defaultAxesFontName','Verdana')
set(groot,'defaultAxesFontSize',12)
And it is possible to set as default several things, for that you need the right class name, to check them:
d = get(groot,'factory');
Substitute factory to default.
To have this setup everytime you open matlab add a startup.m file to your userpath. There is a better explanation about it here: https://blogs.mathworks.com/steve/2019/02/22/making-your-plot-lines-thicker/

카테고리

Help CenterFile Exchange에서 Specifying Target for Graphics Output에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by