gnuplot-py: plotoutput in string?

Nicola Kaiser Nicola.Kaiser at urz.uni-heidelberg.de
Thu Aug 18 10:41:21 EDT 2005


Hi,

I´m using Gnuplot via gnuplot.py and I´m looking for a way to get the 
plotting output (terminal set to png in my case) piped in a string 
instead of to stdout or a file.

Is there any method in gnuplot.py that does this for me?


If not, I tried something like:

p=Gnuplot.Gnuplot(debug=1)
p('set terminal png')
oldstdout=sys.stdout
output=cStringIO.StringIO()
sys.stdout=output
p.plot([[1,0],[2,50],[3,0],[4,20],[5,0],[6,30],[7,70], [8,70], [9, 75], 
[10, 50], [11, 30], [12, 50]])
sys.stdout=oldstdout
print output.getvalue()

But unfortunately I also get other stuff like:

"gnuplot: unable to open display ''
"gnuplot: X11 aborted"

in the same string

Can anyone help me on this?

Thanks,
Nicola




More information about the Python-list mailing list