I've a python script that after some computing will generate two data files formatted as gnuplot input.
How do I 'call' gnuplot from python ?
I want to send the following python string as input to gnuplot:
"plot '%s' with lines, '%s' with points;" % (eout,nout)
where 'eout' and 'nout' are the two filenames.
PS: I prefer not to use additional python modules (eg. gnuplot-py), only the standard API.
Thank You
The subprocess
module lets you call other programs:
import subprocess plot = subprocess.Popen(['gnuplot'], stdin=subprocess.PIPE) plot.communicate("plot '%s' with lines, '%s' with points;" % (eout,nout))
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With