[Pythonmac-SIG] Re: Gnuplot (console)

Anthony M. Ingraldi A.M.INGRALDI@larc.nasa.gov
Tue, 23 Feb 1999 09:36:19 -0500


> 
> I have recently been looking at GNUplot and it occured to me that you
> should be able to drive GNUplot from MacPython by importing the Gnuplot
> object and simply sending it individual commands (rather than
> interactively). Am I right in this?

Absolutely.  All you need to do is pass the command you want executed to the
gnuexec method.

Here's an example that will produce a sine wave plot.  This example makes
use of gnuplot_Suites.py that I included in the gnuplot console package.
(Line wrapping is at the mercy of my e-mail program.)


import gnuplot_Suites, Required_Suite, aetools

# The Creator signature of gnuplot:
SIGNATURE="GPSE"

class GNUPLOT(aetools.TalkTo, Required_Suite.Required_Suite, \
      gnuplot_Suites.gnuplot_Suite, gnuplot_Suites.odds_and_ends,
gnuplot_Suites.Standard_Suite, \
      gnuplot_Suites.Miscellaneous_Events):
   pass

g = GNUPLOT(SIGNATURE, 1)

g.gnuexec('plot sin(x)')


--
   Tony Ingraldi                 |  e-mail: A.M.INGRALDI@LaRC.NASA.GOV
   NASA Langley Research Center  |
   Mail Stop 267                 |  Phone : (757) 864-3039
   Hampton, VA  23681-0001       |  Fax   : (757) 864-7892