font.latex.package in matplotlibrc has no effect using MiKTeX

For other newbies like myself,

Although flushing the ~/.matplotlibrc/tex.cache is an importend thing to
remember, which I did, but forgot to mention (see PS at the bottom), the
reason why:

font packagesfont.latex.package : helvet

Did not give my the desired results (for inclusion into a Beamer LaTeX
Document Class presentation, was that:

"... By default, LaTeX selects a Roman typeface as the document
font...", The LaTeX Companion, Second Edition, p 373

The following line needs to be "placed" in the preamble of the "LaTeX
document" created by and



Peter-Jan Randewijk

PS: A rcParam['tex.cache.flush']='True' option would be an usefull
adition to mpl


-----Original Message-----
From: Samuel M. Smith [mailto:smithsm@…755…]
Sent: 24 October 2005 18:34
To: Randewijk P-J <pjrandew@...841...>
Cc: Samuel M. Smith;
Subject: Re: [Matplotlib-users] font.latex.package in matplotlibrc has
no effect using MiKTeX

If you use the exact same text then it will not change the font
because matplotlib caches the tex redering of text by the name of the
text. You have to delete
the matplotlib tex cache in ~/.matplotlibrc/tex.cache. That will
force it to regenerate the text using the new font.

For example if your plot has a label "Meters" then matplotlib will
use the cached rendering of "Meters". It isn't smart enough to notice
that the cached version uses a different font and therefore must be

On 24 Oct, 2005, at 10:05, Randewijk P-J, Mnr <pjrandew@...841...> wrote:

Dear All MiKTeX/win32 users,

With the following lines in my matplotlibrc file:

text.usetex : True
text.tex.engine : latex

I can generating beautiful LaTeX output for my text labels, I now have

difficulty changing the font from the default, "Computer Times
Roman" to
anything else..

The following line in my matplotlibrc file:

font packagesfont.latex.package : helvet

Have no effect...

Changing "helvet" to:

times, txfonts, pxfont, arial, etc. have also no effect although these

packages are installed...

Even hardcoding, "\usepackage{helvet}" into, has no

        if rcParams['text.usetex']:
            if rcParams['text.tex.engine'] == 'latex':
                fontpackage = rcParams['font.latex.package']
                fontpackage = 'type1cm'
            pw, ph = defaultPaperSize
            if width>pw-2 or height>ph-2: pw,ph =
            print >>latexh, r"""\documentclass{scrartcl}
\usepackage{%s} \usepackage{helvet}

Any ideas...?

Vriendelik die uwe,

   Peter-Jan Randewijk
   Senior Lektor - Drywingselektronika & Elektriese Aandrywing

    Departement E&E. Ingenieurswese
    Universiteit Stellenbosch
    Privaatsak X1
    Matieland, 7603
    Tel: +27 (0) 21 808 4457 (w)
    Faks: +27 (0) 21 808 3951 (w)
    Tel: +27 (0) 21 883 8592 (h)
    Sel: +27 (0) 83 556 5809 (h)

This SF.Net email is sponsored by the JBoss Inc.
Get Certified Today * Register for a JBoss Training Course Free
Certification Exam for All Training Attendees Through End of 2005
Visit Understanding middleware for more information

Matplotlib-users mailing list
matplotlib-users List Signup and Options

Samuel M. Smith Ph.D.
2966 Fort Hill Road
Eagle Mountain, Utah 84043
801-768-2768 voice
801-768-2769 fax
"The greatest source of failure and unhappiness in the world is giving
up what we want most for what we want at the moment"