473,785 Members | 2,482 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 11694
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+\fra c{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.sourceforg e.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
1771
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 http://matplotlib.sourceforge.net, and has many new features since the last major release. Multiple outputs matplotlib now supports postscript and GD output, as well as the
47
3369
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 are objects whose representation within the code is more important than their actual value. Two symbols needs only to be
0
10147
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10090
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9949
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7499
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6739
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5380
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5511
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3645
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2879
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.