MATLAB Answers

changing font size in all the elements of figures

1.495 views (last 30 days)
hamza hamza
hamza hamza on 10 Jun 2015
Commented: 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

Sign in to comment.

Answers (2)

onewhaleid
onewhaleid on 11 Jun 2015
Edited: onewhaleid on 11 Jun 2015
I use findall to change the font size for all text in a single figure:
set(findall(gcf,'-property','FontSize'),'FontSize',12)

  4 Comments

Show 1 older comment
Jon
Jon on 3 Oct 2017
The correct property name is 'DefaultAxesFontSize', as written above you will get an error. Otherwise this does work.
Walter Roberson
Walter Roberson on 3 Oct 2017
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.

Sign in to comment.


Sign in to answer this question.

Tags