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

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 backend_ps.py, has no
effect:

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

Any ideas...?

Vriendelik die uwe,

   Peter-Jan Randewijk
   Senior Lektor - Drywingselektronika & Elektriese Aandrywing

-oOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOo-
    Departement E&E. Ingenieurswese
    Universiteit Stellenbosch
    Privaatsak X1
    Matieland, 7603
    Suid-Afrika
    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)
-oOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOo-

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 re-rendered.

···

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 backend_ps.py, has no
effect:

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

Any ideas...?

Vriendelik die uwe,

   Peter-Jan Randewijk
   Senior Lektor - Drywingselektronika & Elektriese Aandrywing

-oOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOo-
    Departement E&E. Ingenieurswese
    Universiteit Stellenbosch
    Privaatsak X1
    Matieland, 7603
    Suid-Afrika
    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)
-oOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOo-

-------------------------------------------------------
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 http://www.jboss.com/services/certification for more information
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

**********************************************************************
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"
**********************************************************************