How to set default font size and style?

441 views (last 30 days)
K E on 12 May 2015
Answered: Mayra on 30 Jun 2021
In R2015a, how do I set the default text for plot titles, ticklabels, and axes labels to 12 point normal font?

Accepted Answer

Star Strider
Star Strider on 12 May 2015
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:
or to some font more to your liking does what you want.
Peter Harrington
Peter Harrington on 5 Feb 2019
does not work in MATLAB 2018
Error using matlab.ui.Root/set
fontname is an invalid class name

Sign in to comment.

More Answers (2)

Timothy Dalrymple
Timothy Dalrymple on 10 Jun 2020
Edited: Timothy Dalrymple on 10 Jun 2020
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 on 30 Jun 2021
You should use:
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:

Community Treasure Hunt

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

Start Hunting!