Controlling gnuplot via subprocess.Popen

Grant Edwards grante at visi.com
Wed Apr 25 17:48:15 EDT 2007


On 2007-04-25, Peter Beattie <Peter.Beattie at web.de> wrote:
> I am trying to plot something in gnuplot 4.2 using co-ordinates a Python
> 2.5 program computes. Here's what I'm doing:
>
> py> from subprocess import *
> py> plot = Popen("c:/progs/gp/bin/wgnuplot.exe", stdin=PIPE)
> py> plot.stdin.write("plot x*x")
>
> The first command dutifully opens gnuplot, but the second doesn't do
> anything. Could someone favour me with an explanation as to the whyness?

wgnuplot.exe doesn't read commands from stdin.  However,
pgnuplot.exe does (that's why it exists).

It's probably easier to just use the gnuplot-py module:

http://gnuplot-py.sourceforge.net/

The "released" 1.7 version still uses Numeric.  I believe
that it's been converted over to numpy, so if you prefer numpy
over Numeric, you can grab an SVN snapshot.

-- 
Grant Edwards                   grante             Yow! My face is new, my
                                  at               license is expired, and I'm
                               visi.com            under a doctor's care!!!!



More information about the Python-list mailing list