Ask Your Question

font size in matplotlib

asked 2011-12-05 08:00:49 +0200

v_2e gravatar image

Hello! Could somebody please help me find a way to change the font size in Matplotlib plots. Particularly, I would like to change the size of the axis ticks labels.

Thank you. vladimir

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted

answered 2011-12-05 17:03:29 +0200

Felix Lawrence gravatar image

yticks(fontsize=SIZE) should work:

import pylab
import matplotlib
#pylab.rc('text', fontsize=18) #This is a 'bad' but effective way to change the default font size
pylab.plot(xdata, ydata, '--')
pylab.savefig('transspeclin.pdf', format='pdf')
edit flag offensive delete link more

answered 2011-12-05 13:40:04 +0200

Jason Grout gravatar image

updated 2011-12-05 13:43:03 +0200

Is this example from the docs what you want?

Or even just plot(x^2,(x,0,2), fontsize=20)

Note that these answers are for sagecommands. If you are looking for how to deal with matplotlib plots, it might be better to post to the matplotlib help list. Or personally, I usually just look at the matplotlib gallery ( and find something close to what I want.

edit flag offensive delete link more


Yes, I was talking about the direct usage of Matplotlib. An currently the only solution I found is this one:

v_2e gravatar imagev_2e ( 2011-12-05 14:34:42 +0200 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools


Asked: 2011-12-05 08:00:49 +0200

Seen: 18,267 times

Last updated: Dec 05 '11