1

I am trying to plot a simple graph using gnuplot and installed the gnuplot-py binding. I am using the script below and I am getting the below error -

gnuplot> set terminal aqua
     line 0: unknown or ambiguous terminal type; type just 'set terminal' for a list

I am running on a mac.

Here is the code I am using --

import numpy as np
import Gnuplot


def gnudemo2():
    #Create some data
    x = np.linspace(0,10,100)
    y1 = x**2
    y2 = 10*np.sin(np.pi*x)

    #Instantiate Gnuplot object
    g = Gnuplot.Gnuplot(persist=1)

    g('set terminal png size 800,600 enhanced font "Helvetica,8" ')
    g('set style data lines')
    g('set output \'output1.png\'')

    #Create the Gnuplot data
    d1 = Gnuplot.PlotItems.Data(x, y1, with_='lp', title='d1')
    d2 = Gnuplot.PlotItems.Data(x,y2, with_='l', title='d2')

    g.plot(d1,d2)

# when executed, just run gnudemo2():
if __name__ == '__main__':
    gnudemo2()

I am setting the terminal to png but still its trying to use the aqua term.

I installed the aquaterm as well. But it still would not work. What could be going on here?

If I use the same lines inside gnuplot on the command line, everything works fine. So I know the commands are correct. But something is missing when I run them through python.

user220201
  • 4,514
  • 6
  • 49
  • 69
  • Looks like you have two different gnuplot installations. One, which hast the aqua terminal, and another one which is taken when you run the python script because of different PATH settings depending on the environment (something like in [gnuplot doesn't work through ssh command](http://stackoverflow.com/a/23941327/2604213)). – Christoph Aug 11 '14 at 06:34
  • No. There is only one copy of the gnuplot on my machine and I installed it through homebrew – user220201 Aug 11 '14 at 06:45
  • If you are on a mac, can you run the script and see if it works for you? – user220201 Aug 11 '14 at 06:46
  • No, I'm not on a Mac. The thing with the two different installations is the only error I can imagine at the moment, otherwise you should have the same terminals available. To make sure, you could integrate the following line into your script and see if it outputs the same in both situations: `print sprintf("%.1f.%s: %s", GPVAL_VERSION, GPVAL_PATCHLEVEL, GPVAL_TERMINALS)`. – Christoph Aug 11 '14 at 07:42

0 Answers0