setting latex font default

Hello,

I am able to use tex in matplotlib, and it works fine. However, I would
like to make the default font Helvetica, which is the sans-serif font
in the latex package times. Of course, I can achieve this effect by
putting \sf at the beginning of every text string. Is there a better
way? I tried the following:

···

from matplotlib import rc
from matplotlib.font_manager import *
from pylab import *
import string

rc(‘text’, usetex=True)

f = FontProperties()
f.set_family(‘sans-serif’)
f.set_name([‘Helvetica’])


title(‘Test latex’)

As expected, this doesn’t work - it retains serif as the default tex font. Is there a way to change the default tex font?

Regards,
Dev

Dev Gorur wrote:

Hello,

I am able to use tex in matplotlib, and it works fine. However, I would
like to make the default font Helvetica, which is the sans-serif font in
the latex package times. Of course, I can achieve this effect by putting
\sf at the beginning of *every* text string. Is there a better way? I
tried the following:
--------------------------------------
from matplotlib import rc
from matplotlib.font_manager import *
from pylab import *
import string

rc('text', usetex=True)

f = FontProperties()
f.set_family('sans-serif')
f.set_name(['Helvetica'])

<some plot commands>
title('Test latex')
---------------------------------------
As expected, this doesn't work - it retains serif as the default tex
font. Is there a way to change the default tex font?

I guess I should officially submit this as a patch:

http://article.gmane.org/gmane.comp.python.matplotlib.general/3272/

···

--
Robert Kern
rkern@...376...

"In the fields of hell where the grass grows high
Are the graves of dreams allowed to die."
  -- Richard Harter