Bewildered graphs

John J. Lee jjl at
Sat Jul 5 18:32:13 CEST 2003

Mark Fenbers <Mark.Fenbers at> writes:

> I am investigating Python for the sake of ultimately generating
> hydrographs (such as this:
> on-the-fly from a web server cluster.  I have not used Python
> previously and do not yet know if Python is very useful for this or
> if I am wasting my time.

I've done a lot of plotting with Python in the past.  The issue is
really which plotting package(s) you pick rather than anything to do
with Python itself (and nobody here is likely to argue with your
choice of language, of course!).

> Quite frankly, I am a little bewildered.  Not only is there Python,
> but there are many extention modules which cloud up my view as to
> what I will need.

Certainly a year or two ago there was no single free plotting package
around (Python or no Python) that was everything I needed -- and I was
usually plotting pretty straightforward graphs.  Things may have
improved a bit since then, but I certainly think it's worth
considering using a commercial package (from Python).  Presumably you
already use a package of some kind to plot these things?  Most
commercial packages seem to have an API of some sort, so try googling
for a Python binding for it -- one may well already exist.

Otherwise, I'm out of date so can't give you a simple 'use this', but
in general:

Just to confuse you further, another option is to use a generic
plotting library, rather than one designed specifically for graphs.
If the format of your graphs isn't going to change, that might be a
reasonable choice.  You end up with more code, but you avoid having to
figure out how to tickle exactly what you want out of a reluctant
plotting package.  In particular, you can be sure you won't get stuck
in the 'so far and no further' situation that graphing packages can
leave you in.

I'd probably first run though the demos that invariably come with the
graphing packages, and if it wasn't fairly obvious that a) all the
necessary features were there in one of them and b) reasonably clear
the example code / docs c) lightweight enough not to bring your web
server to its knees, I'd try a generic plotting library.  Ordered by
my guess of most appropriate first: PIL, PIDDLE, reportlab (nicer API
than PIDDLE; pdf output, but you could probably convert to .png easily
enough), plotutils, sketch.

Of the graph plotting packages, some that should get the job done:

Grace (
 API documentation poor last time I looked, but does everything you
 could want, and has a (rather nasty) GUI interface too, so you can
 tweak graphs for publication.  If load on the web server is high, it
 might be too heavyweight, though.

DISLIN (pxDislin)
 You probably want the pxDislin binding, not the one distributed with
 DISLIN itself.

 Haven't used this.  Probably a nice API, but looks like it's still
 not very capable.

Lots of others too, I'm afraid: PLPLOT, PGPLOT, gnuplot, Qwt,

> There's Scientific Python, which sounds promising, but there's also
> SciPy which

I haven't used the plotting software from either (I don't think
Scientific Python had any plotting code when I used it).  In general,
they do different things.  One obvious difference is that Scientific
Python is (mostly, at least) new, pure Python code, where SciPy wraps
a lot of old, well-tested Fortan, C and C++ code (but no doubt there's
a fair amount of pure Python code there too).  Both approaches have
pros and cons, and the particular codes in SciPy and Scientific Python
have different objectives, of course.


More information about the Python-list mailing list