Feed on
Posts
Comments

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)


Bookmark and Share

if that was helpful ...

check out the other tips and tricks i've compiled on these pages. you might learn something else interesting!

3 Responses to “change font size in matplotlib legend”

  1. on 30 Aug 2011 at 10:03 pm Jorge

    I just want to thank you, you have saved me a lot of search.

    Cheers
    Jorge

  2. on 19 Apr 2012 at 12:54 pm Gerardo

    Thanks dude!

  3. on 20 Oct 2012 at 10:12 am Toby Burnett

    Not wrong, but this is much more compact:

    gca().legend(…, prop=dict(size=’small’))

    that ‘size’ can be the number of points as well.

Did I get this wrong? Let me know!

Trackback URI | Comments RSS