Controlling gnuplot via subprocess.Popen
James Stroud
jstroud at mbi.ucla.edu
Wed Apr 25 17:27:06 EDT 2007
Peter Beattie 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?
>
Why re-invent the wheel? Not trying to be pedantic, but usually the
google search
"python %s" % thing_im_working_on
will yield lucrative results that far exceed anything you can create in
a reasonable amount of time. For example, "python gnuplot" first hit is:
http://gnuplot-py.sourceforge.net/
And speaking from experience, it works beautifully.
James
More information about the Python-list
mailing list