Ask Your Question
1

Change font size for all texts in a graph

asked 8 years ago

Massimo2013 gravatar image

Is it possible to set the font size for all labels in a plot? I have been able to set the font family changing the internal parameters of matplotlib

from matplotlib import rc
rc('text',usetex=True)
rc('font',**{'family':'serif','serif':['Times']})

I'd like to change the size as well, so that all labels created with 'text' are the same size (note that I want to use TeX in labels)

Preview: (hide)

2 Answers

Sort by » oldest newest most voted
3

answered 8 years ago

ndomes gravatar image

A quite simple way without touching matplotlib configuration:

kwds = {'color':'red','fontsize':16,'fontweight':'bold','rotation':30}
G = Graphics()
G += text('TEST',(2,1),**kwds)
G += text('TEST',(-2,1),**kwds)
G.show()
Preview: (hide)
link

Comments

you need the two astherics? I mean, writing just kwds will not work too?

Masacroso gravatar imageMasacroso ( 8 years ago )
0

answered 8 years ago

Have you tried adding 'size' : number to your font dictionary?

http://matplotlib.org/api/matplotlib_...

Preview: (hide)
link

Comments

Adding 'size' : number seems to have no effect.

ndomes gravatar imagendomes ( 8 years ago )

Your Answer

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

Add Answer

Question Tools

1 follower

Stats

Asked: 8 years ago

Seen: 1,391 times

Last updated: Oct 22 '16