473,385 Members | 1,387 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

python plotting with greek symbols within labels recommendations?

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.

pygrace (http://www.its.caltech.edu/~mmckerns/software.html) seems to
be able to inherently support symbols, but it doesn't follow the tex
formatting. it has its own (seemingly arbitrary) syntax.

any thoughts on plotting libraries would be much appreciated.

mike

Oct 4 '05 #1
5 11668
mi***************@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
rk***@ucsd.edu

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

Oct 5 '05 #2
mi***************@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.


And, incidentally, if you're only interested in letters and symbols
strung out horizontally with the Latin characters rather than formula
layout, you can use Unicode if your font supports it:

In [41]: s
Out[41]: u'This is \u0393reek to me'

In [42]: rc('font', serif=['Code2000'])

In [43]: title(s)

--
Robert Kern
rk***@ucsd.edu

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

Oct 5 '05 #3

mike> thus far, i've found that matplotlib
mike> (http://matplotlib.sourceforge.net/) can do this, albeit the
mike> implementation is so poor that you cannot mix standard text with
mike> symbols on the same plot element.

That seems a bit harsh. Have you asked on the matplotlib mailing list to
see if it can do what you want?

Skip
Oct 5 '05 #4
mi***************@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.


If you already have installed matplotlib, have a look at
matplotlib-0.X.Y/examples/tex_demo.py
It shows you how to mix text and symbols.
The other examples in the directory could also be useful.

Essentially you need to remember
matplotlib.rc('text', usetex=True)
before plotting.

If you need complex stuff (fractions, sums, integrals) try
putting an r before the string: pylab.ylabel(
r"Density $\left(\rho =\frac{x^2+\frac{x+1}{x-1}}{\kappa(x)K_{ij}}\right)")
works fine, at least on my system.
Oct 5 '05 #5
Hi,

mi***************@gmail.com wrote:
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).


You may want to have a look at PyX (pyx.sourceforge.net), which
features a seamless TeX integration for all typesetting tasks and thus
allows you to use TeX syntax all over the place.

André

Oct 5 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: John Hunter | last post by:
matplotlib is a 2D plotting package for python with a matlab compatible syntax and output tested under linux and windows platforms. matplotlib-0.30 is available for download at...
47
by: Pierre Barbier de Reuille | last post by:
Please, note that I am entirely open for every points on this proposal (which I do not dare yet to call PEP). Abstract ======== This proposal suggests to add symbols into Python. Symbols...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.