Gnuplot: line 0: function to plot expected
Question: 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 :)


Answer: 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 --

    
    
    g('set terminal png')
    g('set output "bench.png"')
    g.plot(d1)  #d1 should not be in "bench.png"
    #This might work to plot both datasets together ... g.plot(d1,d2)  
    

This should work as long as the internals of gnuplot-py don't reset the
gnuplot script whenever a `plot` command is issued. I highly doubt this is the
case since the `__call__` method seems to be such an important part of the
API.

