How to set default font size and style?

461 ビュー (過去 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 Center および File ExchangeGraphics Object Properties についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by