Matplotlib is a great program with a python interface for making 2D plots, both with python scripts and interactively. It can display plots with a variety of interfaces and also output them as eps, etc.
One nice feature is that using matplotlib.texmanager, you can have it use your native LaTeX installation interpret everything in the plot. That means everything has the same font and style as the program you are embedding it in, and you can put any kind of mathematical formula you like in there.
There is documentation on texmanager and also a little tutorial in the matplotlib examples called tex_demo.py.
Essentially, you need to set the following in your python script to activate latex interpretation:
rc('text', usetex=True)
and only export to eps or ps. Only PS and Agg are supported formats for LaTeX.
To get this working on Fedora Core 4, you need a newer version of ghostscript, downloadable in source format from here. Get ghostscript version 8.51 and the fonts tarball, and make sure you have libjpeg-devel, libpng-devel, and zlib-devel installed.
You can just do the standard for the ghostscript-8.51 source directory structure
% ./configure
% make
% make install
as root, and it will automatically install in /usr/local. I didn’t need the fonts directory at all for my tests, but it may be necessary in some situations.
Once it is installed, matplotlib should create latex files naturally, and they will look great!
UPDATE:
There is a problem with the pygtk threading code that can sometimes cause the TeX output to fail. One way around this is to use the TkAgg extension instead. Just make sure you have that option installed and edit your matplotlibrc file to use TkAgg as the default backend, and it should produce TeX output perfectly.