using the symbol font in TeX plots

Hi all,

To annotate my figures with Greek letters, I use the following:

import matplotlib
matplotlib.use('PDF')
import matplotlib.pyplot as plt
from matplotlib import rc
rc('font',**{'family':'sans-serif','sans-serif':['Helvetica']})
plt.rcParams['ps.useafm'] = True
rc('font',**{'family':'sans-serif','sans-serif':['Helvetica']})
plt.rcParams['pdf.fonttype'] = 42
# plot figure
# ...
# annotate figure
plt.xlabel(r'$\mu$ = 50')
plt.ylabel(r'$\sigma$ = 1.5')

This makes the equal symbol and everything to the right of it in the
Helvetica font, as intended, and the Greek symbols default to the
usual TeX font (which I believe is Times New Roman.)

How can I make it so the font used for the Greek letters is the
"Symbol" font instead? It's important for me not to have it appear in
the default Times font of TeX.

thanks for your help.

per freem wrote:

Hi all,

To annotate my figures with Greek letters, I use the following:

import matplotlib
matplotlib.use('PDF')
import matplotlib.pyplot as plt
from matplotlib import rc
rc('font',**{'family':'sans-serif','sans-serif':['Helvetica']})
plt.rcParams['ps.useafm'] = True
rc('font',**{'family':'sans-serif','sans-serif':['Helvetica']})
plt.rcParams['pdf.fonttype'] = 42
# plot figure
# ...
# annotate figure
plt.xlabel(r'$\mu$ = 50')
plt.ylabel(r'$\sigma$ = 1.5')

This makes the equal symbol and everything to the right of it in the
Helvetica font, as intended, and the Greek symbols default to the
usual TeX font (which I believe is Times New Roman.)

How can I make it so the font used for the Greek letters is the
"Symbol" font instead? It's important for me not to have it appear in
the default Times font of TeX.
  

There's information about changing the math font here:

http://matplotlib.sourceforge.net/users/mathtext.html#fonts

You may be able to use "Symbol" as a custom font, but this is untested, as far as I know. It would have to contain a Unicode mapping to be usable.

Mike

···

--
Michael Droettboom
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA

per freem wrote:

Hi all,

To annotate my figures with Greek letters, I use the following:

import matplotlib

matplotlib.use(‘PDF’)

import matplotlib.pyplot as plt

from matplotlib import rc

rc(‘font’,**{‘family’:‘sans-serif’,‘sans-serif’:[‘Helvetica’]})

plt.rcParams[‘ps.useafm’] = True

rc(‘font’,**{‘family’:‘sans-serif’,‘sans-serif’:[‘Helvetica’]})

plt.rcParams[‘pdf.fonttype’] = 42

plot figure

annotate figure

plt.xlabel(r’$\mu$ = 50’)

plt.ylabel(r’$\sigma$ = 1.5’)

This makes the equal symbol and everything to the right of it in the

Helvetica font, as intended, and the Greek symbols default to the

usual TeX font (which I believe is Times New Roman.)

How can I make it so the font used for the Greek letters is the

“Symbol” font instead? It’s important for me not to have it appear in

the default Times font of TeX.

There’s information about changing the math font here:

http://matplotlib.sourceforge.net/users/mathtext.html#fonts

You may be able to use “Symbol” as a custom font, but this is untested,

as far as I know. It would have to contain a Unicode mapping to be usable.

Mike

Hello,

Any ideas why this piece is not showing properly?

#!/usr/bin/python

-- coding: utf-8 --

from pylab import *

plot([1]*5)
xlabel(u’μ = 50’)

ylabel(u’σ = 1.5’)

show()

···

On Tue, Jan 26, 2010 at 11:29 AM, Michael Droettboom <mdroe@…86…> wrote:

Michael Droettboom

Science Software Branch

Operations and Engineering Division

Space Telescope Science Institute

Operated by AURA for NASA


The Planet: dedicated and managed hosting, cloud storage, colocation

Stay online with enterprise data centers and the best network in the business

Choose flexible plans and management services without long-term contracts

Personal 24x7 support from experience hosting pros just a phone call away.

http://p.sf.net/sfu/theplanet-com


Matplotlib-users mailing list

Matplotlib-users@lists.sourceforge.net

https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Gökhan