MATLAB Answers

How do I change the font size in my legend?

Asked by MathWorks Support Team on 27 Jun 2009

When I attempt to change the font size of the text in a legend using the code shown below, the text becomes very large:

LEG = findobj(AX,'type','text');


1 Answer

Answer by MathWorks Support Team on 27 Jun 2009
 Accepted answer

In order to change the font size for a MATLAB legend, use the SET command to change the 'FontSize' property of the legend object, as in the example below.


In MATLAB 7.1 (R14SP3), saving the figure to file after changing the Font Size on the legend may revert the font sizes to the original size. To work around this, the following option can be used from the Command Window to print the figure to a

file :

print -dbmp16m 'myfig.jpg'


Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi test

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

MATLAB Academy

New to MATLAB?

Learn MATLAB today!