change font size in matplotlib legend
June 27th, 2011 by Lawrence David
to change the font size in a matplotlib legend:
import pylab
import matplotlib.font_manager as fm
fig = pylab.figure()
prop = fm.FontProperties(size=5)
figlegend.legend(handle_l,label_l,prop=prop)
I just want to thank you, you have saved me a lot of search.
Cheers
Jorge
Thanks dude!
Not wrong, but this is much more compact:
gca().legend(…, prop=dict(size=’small’))
that ‘size’ can be the number of points as well.