66

When I try to plot a graph on GNU Octave, and try to use plot, it gives me the following output

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

I am using Mac OS X 10.9.2. I have tried using

octave:79> setenv("GNUTERM","X11")

but I still get the same error.

Stephan Kolassa
  • 7,953
  • 2
  • 28
  • 48
user2472071
  • 767
  • 1
  • 6
  • 11

8 Answers8

268

setenv("GNUTERM","qt") in your octave command prompt, it should solve the problem.

Ozgur_Oz
  • 78
  • 6
Cheng Long
  • 2,896
  • 1
  • 14
  • 3
  • Thanks this helped. I am more interested in what is going on. Mind explaining a bit? – Codier Feb 07 '15 at 12:46
  • 1
    Hey Cheng, I get a new error after using the command. Qt terminal communication error: select() error 9 Bad file descriptor. How to revert to default? – Nirdesh Dwa Jun 23 '15 at 12:19
  • Thanks it works. Why does this solve the problem? What is qt? – mc9 May 08 '16 at 10:29
  • It works, but every time I start a new octave session, I need to type the command again to plot figure. – Ladih Aug 28 '16 at 17:46
  • 9
    To use this every time you can add this command to the 'octaverc' file in the octave startup folder. On osx el capitan mine is at '/usr/local/octave/3.8.0/share/octave/site/m/startup/'. – user3055034 Sep 09 '16 at 18:24
  • I guess `qt` means `query or set` according to [Introduction-to-Plotting](https://www.gnu.org/software/octave/doc/interpreter/Introduction-to-Plotting.html#Introduction-to-Plotting) and [Graphics-Toolkits](https://www.gnu.org/software/octave/doc/interpreter/Graphics-Toolkits.html#Graphics-Toolkits) – Cloud Aug 24 '17 at 01:30
9

I think your problem comes from using the CLI.

As of January 2, 2014. If you're using OS/X 10.9 (Maverics) then you can opt to use integrated GUI from the binary package by downloading the Octave 3.8.0 .dmg. Use Octave-gui not Octave-cli, or otherwise start the GUI from the CLI.

A note about the gui from The Octave Home Page

But because it is not quite as polished as we would like, we have decided to wait until the 4.0.x release series before making the GUI the default interface (until then, you can use the --force-gui option to start the GUI).

Community
  • 1
  • 1
waTeim
  • 9,095
  • 2
  • 37
  • 40
7

The following worked out for me

  1. Uninstall any existing gnuplot on your OSX

    brew uninstall gnuplot

  2. Install gnuplot with either X or X11

    brew install gnuplot --with-x

  3. Finally, set the GNUTERM to X11

    setenv("GNUTERM","X11")

Desta Haileselassie Hagos
  • 23,140
  • 7
  • 48
  • 53
4

And if you need Aqua terminal instead of X11 - this might help:

brew uninstall --force gnuplot

brew install gnuplot --with-aquaterm --with-qt4

You don't need to add setenv("GNUTERM","X11") or add GNUTERM env.var to octaverc file.

Anthony Akentiev
  • 1,001
  • 11
  • 9
  • 1
    You have a typo in your first command ("unintall" should be "uninstall"). – Andi Jul 07 '16 at 14:34
  • 1
    Thanks @Andi for figuring that out. – Anthony Akentiev Jul 08 '16 at 11:38
  • 1
    Just an additional note: *you need Aquaterm installed before you run the latter Brew command* for this to work. But if you don't have it, you should be notified about that during the installation and just need to install Aquaterm and then do these steps again. – MJV Oct 06 '16 at 05:38
2

I've got this problem too and solved by installing an Aquaterm for mac as mentioned here.

p.s. If you get warnings like "warning: could not match any font: *-normal-normal-10" as I did, try to check your /usr/local/etc/fonts/fonts.conf

Leon.Z
  • 61
  • 3
  • 1
    Welcome to Stack Overflow! Whilst this may theoretically answer the question, [it would be preferable](//meta.stackoverflow.com/q/8259) to include the essential parts of the answer here, and provide the link for reference. – Enamul Hassan Apr 14 '16 at 02:24
2

To install it without aquaterm:

brew cask install xquartz
brew install gnuplot --with-x
brew install octave

vim ~/.octaverc
setenv("GNUTERM", "X11")
graphics_toolkit("gnuplot");
laktak
  • 57,064
  • 17
  • 134
  • 164
0

I got the same problem when using Octave-cli, and I just avoid this by using "Octave-gui".

liamlee
  • 311
  • 2
  • 3
  • 10
0

Download and install Aquaterm.

sudo wget https://gist.githubusercontent.com/tuvistavie/8466870/raw/9064b4b3dfb3644950b6f5745056f54f8d6e56c6/gnuplot.rb -O /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/gnuplot.rb

brew uninstall gnuplot
brew update && brew upgrade
brew tap homebrew/science
brew info gnuplot

brew reinstall gnuplot --aquaterm --qt --test

worked for me ref

pavan
  • 3,225
  • 3
  • 25
  • 29