Ask Your Question

Change font size for all texts in a graph

asked 2016-10-20 22:02:31 +0200

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

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)

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted

answered 2016-10-22 11:07:16 +0200

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)
edit flag offensive delete link more


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

Masacroso gravatar imageMasacroso ( 2016-10-23 12:48:19 +0200 )edit

answered 2016-10-21 23:06:00 +0200

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

edit flag offensive delete link more


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

ndomes gravatar imagendomes ( 2016-10-22 00:17:09 +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

1 follower


Asked: 2016-10-20 22:02:31 +0200

Seen: 1,211 times

Last updated: Oct 22 '16