[SciPy-user] Matplotlib fonts

John Hunter jdhunter at ace.bsd.uchicago.edu
Thu Sep 1 10:05:50 CDT 2005

>>>>> "Howey," == Howey, David A <d.howey at imperial.ac.uk> writes:

    David> Does anyone know any easy way to set the 'global' font
    David> sizes for eg.  tick mark labels, titles, xlabels, ylabels
    David> for matplotlib? I would rather not use the matplotlibrc
    David> file since I want the code to be platform independent. Can
    David> I set something in my code that will then affect all
    David> subsequent figures?

This question is more appropriate on  matplotlib-users (attempting to set
followups).  You can subscribe at
http://lists.sourceforge.net/mailman/listinfo/matplotlib-users .

You can also set the rc params from within a script, and this will
affect all subsequent figures.  There are two ways to do it.

 * Use rcParams; this is a dictionary where the keys are the same as
   in the rc file

    from matplotlib import rcParams
    rcParams.update( {
        'font.family'  : 'serif',
        'font.style'   : 'normal',
        'font.variant' : 'normal',
        'font.weight'  : 'bold',
        'font.stretch' : 'normal',
        'font.size'    : 'large',

    from pylab import *

or use the "rc" command, which may be syntactically nicer but is
equivalent; see

    from matplotlib import rc
    rc('font',  family='serif', style='normal', variant='normal',
       weight='bold',  stretch='normal', size='large')

    from pylab import *

Note that changing these in the rc file is almost as portable.
matplotlib respects per directory rc files, so you can make your
customizations in the rc file and distribute it with your
script/application and this will override the user's default


More information about the SciPy-user mailing list