# python plotting with greek symbols within labels recommendations?

Robert Kern robert.kern at gmail.com
Wed Oct 5 02:02:00 CEST 2005

michael.s.gilbert at gmail.com wrote:
> hello all,
>
> this message is geared toward those of you in the scientific community.
> i'm looking for a python plotting library that can support rendering
> greek symbols and other various characters on plot axes labels, etc. I
> would prefer something that adheres to tex formatting (as implemented
> in latex, matlab, etc and has the form $\alpha$ to represent the greek
> character alpha for example).
>
> thus far, i've found that matplotlib
> (http://matplotlib.sourceforge.net/) can do this, albeit the
> implementation is so poor that you cannot mix standard text with
> symbols on the same plot element.

You can if you have TeX installed and enable text.usetex in your
configuration. E.g.

In [4]: title('This is $\Gamma$reek to me.')

There isn't much out there that allows a reasonably full range of TeX
without calling out to TeX.

If you want to improve the non-TeX fallback for matplotlib's mathtext
module to support math-mode text embedded in plain text, I'm sure John
would love to see your contribution. It shouldn't be that hard; it's
just nobody's had the motivation to work on it given the availability of
real TeX labels.

--
Robert Kern
rkern at ucsd.edu

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