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
A simple approach might be to just write a third file containing your gnuplot commands and then tell Python to execute gnuplot with that file. Say you write
"plot '%s' with lines, '%s' with points;" % (eout,nout)
to a file called tmp.gp. Then you can use
from os import system, remove
system('gnuplot -persist tmp.gp')
remove('tmp.gp')