I’ve a python script who generate a graphic with gnuplot. But I’ve an error:
gnuplot> plot
^
line 0: function to plot expected
g=Gnuplot.Gnuplot(persist=1)
g.title('Read&Write Performance')
g.xlabel('minutes')
g.ylabel('MB/s')
g('set term png')
g('set out')
g('set yrange [0:70]')
d1=Gnuplot.Data(self.time,self.list1,title="perfr", with_="line")
d2=Gnuplot.Data(self.time,self.list2,title="perfw", with_="line")
time.sleep(2)
g.hardcopy('bench.png',terminal = 'png')
g.reset()
self.list1= [12, 15, 17]
self.list2 = [43, 48, 49]
I don’t understand why I’ve this error.
Thanks 🙂
After a very brief look at the source, it seems that g.plot() does not send the plot to a window (e.g. x11), but to wherever gnuplot is currently configured to send the plot. So, (I think) the easiest solution is —
This should work as long as the internals of gnuplot-py don’t reset the gnuplot script whenever a
plotcommand is issued. I highly doubt this is the case since the__call__method seems to be such an important part of the API.