Changing Plot and Label font

35 views (last 30 days)
Hi all,
I have 3 simple questions,
1. Is it possible to change the font sizes of the numbers on a plot's axes? If so, how?
2. I make frequent use of the property editor to change the font size of my plot's labels, how can I code for this?
3. Is it possible to change the font style of labels on a plot (i.e bold italic ect.)?
Thank you, Nikolay

Accepted Answer

Oleg Komarov
Oleg Komarov on 23 May 2012
Suppose you have the following example:
x = -pi:.1:pi;
y = sin(x);
plot(x,y)
lx = xlabel('x');
ly = xlabel('y');
1. Change FontSize
set(gca,'FontSize',14)
2. Yes. When creating labels, store their handles into some variables, then use set(). See also get() and the useful inspect().
3. Yes. To control string properties see this link http://www.mathworks.co.uk/help/techdoc/ref/text_props.html#String
set(lx,'string','\it x')

More Answers (0)

Community Treasure Hunt

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

Start Hunting!