So you want graphing capability?

nbecker at fred.net nbecker at fred.net
Tue Nov 9 16:44:49 EST 1999


I just tried a quick experiment to allow python to talk to grace (aka
xmgrace aka xmgr aka xgr)

The latest grace-5.0.5 has a library to give access via a pipe
connection.

I wrote a simple SWIG I/F.  A little Makefile hacking to build
libgrace_np as a shared lib, and presto:

One minor problem is that GracePrintf is vararg, and swig won't work
with it.  No loss really.  Just use GraceCommand.

>python
Python 1.5.2 (#1, Sep 17 1999, 20:15:36)  [GCC egcs-2.91.66 19990314/Linux (egcs- on linux-i386
Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam
>>> import grace
>>> x=grace.GraceOpen(2048)
grace.GraceCommand("g0.s0 point 0, 0")
0
>>> grace.GraceCommand("g0.s0 point 1, 1")
0
>>>grace.GraceCommand("redraw")
0
>>> grace.GraceClose()
0

Now you can have REALLY nice plots.  Interested?




More information about the Python-list mailing list