MATLAB Answers


changing font size in all the elements of figures

Asked by hamza hamza on 10 Jun 2015
Latest activity Commented on by David Franco on 26 Apr 2018
Hello, i want to make bigger all the text in a figure ( title, xlabel, axis,....), so i wrote this line of code in the beginning of the script: set(0,'defaulttextfontsize',30) but it doesn't change anything at all. Could you help me please, how can i change the font size? thank you

  1 Comment

Try this

Sign in to comment.


2 Answers

Answer by onewhaleid on 11 Jun 2015
Edited by onewhaleid on 11 Jun 2015

I use findall to change the font size for all text in a single figure:


Show 1 older comment
The correct property name is 'DefaultAxesFontSize', as written above you will get an error. Otherwise this does work.
DefaultAxesFontSize is a better programming practice, but when you use set() the property names are not case sensitive.
set(0,'defaultaxisfontsize',30) or set(0, 'DefaultAxesFontSize', 30) only works for axes text created after the call to set(); it does not change the size for any existing text object, which the findall() version does change.
Works perfectly @onewhaleid. Thanks! +1

Sign in to comment.