11

I am new to octave, I just tried my first plotting with Octave 3.4.0 when I get the following error. Any help will be much appreciated. The gnuplot version is 4.6

     octave-3.4.0:3> x=1:1:20;
     octave-3.4.0:4> y=sin(x);
     octave-3.4.0:5> plot(x,y)

     gnuplot> set terminal aqua enhanced title "Figure 1" size 560 420  font "*,6"
                  ^
     line 0: unknown or ambiguous terminal type; type just 'set terminal' for a list

The terminal window I am using for octave is the mac X-terminal.

8 Answers8

19

Ok, I found the solution to this problem. Just run:

setenv("GNUTERM","X11")

Before you plot anything, e.g.,

plot(x,y)
jscs
  • 63,694
  • 13
  • 151
  • 195
15

You might need to reinstall gnuplot with x11 support:

brew uninstall gnuplot;brew install gnuplot --with-x

behas
  • 3,386
  • 5
  • 27
  • 27
13

Also you could add this line to your ~/.octaverc file:

setenv GNUTERM x11

- it works for me on mac os mountain lion.

pupadupa
  • 1,530
  • 2
  • 17
  • 29
4

COMPLETE SOLUTION:

1- Install x11:

brew cask install xquartz

Or, install from here.

2- Reinstall gnuplot:

brew uninstall gnuplot && brew install gnuplot --with-x11

3- Put these lines in ~/.octaverc

setenv("GNUTERM", "x11")
gnuplot_binary("/usr/local/bin/gnuplot")

4- Restart your mac

Inanc Gumus
  • 25,195
  • 9
  • 85
  • 101
2

or put this line into your .profile (or .zshrc whatever):

export GNUTERM=x11

this will make all gunplot invokations (besides Octave) to output to x11.

xinthink
  • 1,460
  • 1
  • 18
  • 22
1

Just add:

setenv ("GNUTERM", "X11")

to your octaverc file, normally located at /usr/local/share/octave/site/m/startup

sharno
  • 630
  • 8
  • 14
1

I added:

setenv("GNUTERM", "qt")

to the octaverc file located in /usr/local/octave/3.8.0/share/octave/3.8.0/m/startup, and then it worked again.

neural5torm
  • 773
  • 1
  • 9
  • 21
  • I didn't use brew or macports but used precompiled binaries. And setenv ("GNUTERM", "X11") didn't work. Your solution works just fine. – irudyak Jul 25 '15 at 22:19
0

Just put here. When this error happened on me, I found this post and update my octaverc file with "setenv GNUTERM X11".

Then octave generated another error:

    error: popen2: popen2 (child): unable to start process -- No such file or directory
    error: called from:
    error: /usr/local/Cellar/octave/3.8.0/share/octave/3.8.0/m/plot/util/private/__gnuplot_open_stream__.m at line 30, column 40
    error: /usr/local/Cellar/octave/3.8.0/share/octave/3.8.0/m/plot/util/__gnuplot_drawnow__.m at line 72, column 19
    sh: x11: command not found

And the solution to that was adding gnuplot_binary("usr/YO/bin/gnuplot") to the octaverc file in /usr/local/share/octave/site/m/startup

Now plotting in octave is happy.

willawill
  • 468
  • 6
  • 4