[SciPy-user] Matplotlib fonts

Howey, David A d.howey at imperial.ac.uk
Thu Sep 1 10:09:45 CDT 2005


Wicked. This is just what I needed. Thanks. I will try and join the
matplotlib list now!
Dave 

-----Original Message-----
From: scipy-user-bounces at scipy.net [mailto:scipy-user-bounces at scipy.net]
On Behalf Of John Hunter
Sent: 01 September 2005 16:06
To: SciPy Users List
Subject: Re: [SciPy-user] Matplotlib fonts

>>>>> "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 *
    plot([1,2,3])
    show()

or use the "rc" command, which may be syntactically nicer but is
equivalent; see
http://matplotlib.sourceforge.net/matplotlib.pylab.html#-rc

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


    from pylab import *
    plot([1,2,3])
    show()

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
configuration.

JDH

_______________________________________________
SciPy-user mailing list
SciPy-user at scipy.net
http://www.scipy.net/mailman/listinfo/scipy-user



More information about the SciPy-user mailing list