139

I've installed Octave and gnuplot via Homebrew, and downloaded AquaTerm.dmg. When I try to plot, I get the following message:

octave:4> plot(x,y)

gnuplot> set terminal aqua enhanced title "Figure 1" font "*,6"

                  ^
     `line 0: unknown or ambiguous terminal type; type just 'set terminal' for a list`

In a bash terminal set terminal, set Terminal, set term, (and the same, followed by "aqua" too) etc gives nothing. I've tried plotting again from octave having the "AquaTerm" already open, but nothing. I've tried plotting directly from gnuplot but same problem.. How can I do this "set terminal aqua"?

Gnuplot starting message says "Terminal type set to 'x11'" but no idea how to change it, the previous commands didn't work neither.

Since AquaTerm wasn't installed from Homebrew maybe octave/gnupot can't find it... but no idea. Any guess? Thanks!

PGreen
  • 3,239
  • 3
  • 24
  • 29
  • What on earth does this have to do with bash? You are asked to type `set terminal` in gnuplot, not in bash. – n. m. could be an AI Dec 09 '12 at 19:18
  • 1
    @n.m I tried in bash because typing "set terminal" rigt after the message (and therefore, inside octave) gave error. Now I tried opening gnuplot and type "set terminal" and it worked, it shows a list in which aqua isn't there. Thanks for the link! Since I have installed gnuplot from `brew` I didn't compile it directly. if I download and compile gnuplot outside brew don't know if will be any conflict or problem with octave... – PGreen Dec 09 '12 at 20:03
  • 1
    For Linux users: Try installing `gnuplot-x11` and add `setenv("GNUTERM","X11")` to your `~/.octaverc`. – Martin Thoma Jun 28 '14 at 19:52
  • `setenv("GNUTERM","qt")` worked for me. – giapnh Jun 10 '19 at 08:21

15 Answers15

110

I had to add setenv("GNUTERM","X11") to OCTAVE_HOME/share/octave/site/m/startup/octaverc (OCTAVE_HOME usually is /usr/local) to make it work permanently.

Solution found and more details on: http://www.mac-forums.com/forums/os-x-apps-games/242997-plots-octave-dont-work.html

nightlyop
  • 7,675
  • 5
  • 27
  • 36
  • If you ever want to revert it, the original value is `aqua`. `octave:1> getenv GNUTERM ans = aqua` – DeepSpace101 Apr 25 '13 at 00:27
  • 8
    If you don't want to update the global octaverc, simply create a file ~/.octaverc and enter the setenv command in there. – Raj Mar 11 '14 at 06:08
  • 88
    I just installed Octave 3.8.0 on OS X 10.9 (Mavericks), and the Octave bundle seems to be set up to use Qt for windowing (rather than aqua or x11) using gnuplot_qt. Creating a ~/.octaverc file containing `setenv("GNUTERM","qt")` worked for me (thanks @Raj and @nightlyop). – tomelgin Mar 29 '14 at 22:38
  • 1
    if you used Homebrew to install Octave, you will find the octaverc file in the following path: `usr/local/Cellar/octave/4.0.0_5/share/octave/site/m/startup/octaverc` – Kevin Zhao Mar 30 '16 at 20:07
  • This works why it didn't submitted as the correct answer? – pouyan021 May 19 '16 at 16:39
  • I'm using OSX 10.11 (El Capitan) with Octave 3.8.0 and this worked perfectly! – Saehun Sean Oh Aug 22 '16 at 01:36
  • 6
    setenv("GNUTERM","qt") worked for me on Sierra 10.12.6. "x11" did not. – Trevis Thomas Aug 30 '17 at 18:12
  • @TrevisThomas thanks!, the same works in macOS Mojave 10.14.6 – Guille Dec 27 '19 at 15:15
82

I've ran into a similar issue with Octave-cli, version 3.8.0, on OS X 10.9.1. Observing how Octave-gui could still plot charts, and reading up the answer with octaverc, I've got plotting to work from Octave-cli by adding a line with setenv("GNUTERM","qt") to /usr/local/octave/3.8.0/share/octave/site/m/startup/octaverc

I didn't have to re-install gnuplot or other dependencies.

rehumbus
  • 821
  • 6
  • 2
  • 6
    Setting GNUTERM to qt worked for me (not X11) but I put it in my home directory (~/.octaverc) not the directory mentioned above. I don't know what the difference is but home directory seems to be more installation neutral. – sepans Mar 29 '14 at 15:17
  • 3
    I've also added setenv("GNUTERM","qt") to the my home directory ~/.octaverc and ploting with octave is now working like a charm. Thanks – chekkal Jun 25 '14 at 23:49
  • Thanks. Works for El Capitan! – Rohan May 01 '16 at 04:30
69

Setting the terminal type to x11 would solve the problem, but if you want to get AquaTerm working with gnuplot here's how:

First we need to uninstall the existing installation of gnuplot, open up a terminal and run this command.

brew uninstall gnuplot

Download AquaTerm from here: http://sourceforge.net/projects/aquaterm/ and install as you would any OSX application.

From here on, there are two ways to get gnuplot happy with aquaterm, Method 1 is easier, but didn't work for me because my AquaTerm installation didn't create the correct symlinks in /usr/local/lib, Method 2 is the one that worked for me, and I am sharing the steps I took to get it working.

Method 1: Simply reinstall gnuplot after installing AquaTerm seems to fix this issue for people.

brew install gnuplot

Go to the verify step to see if everything worked, if not, follow method 2

Method 2: This method is more advanced, but guaranteed to work if you are patient.

Essentially gnuplot cannot locate the AquaTerm library files, that's why aqua doesn't show up as a terminal type option after we installed gnuplot. We need to modify the homebrew recipe for gnuplot to enable aquaterm support, open up the brew recipe for gnuplot by typing:

brew edit gnuplot

And add these lines as shown in this github commit message, this will enable the brew option for gnuplot to include aquaterm https://github.com/mxcl/homebrew/issues/14647#issuecomment-21132477

Check to see if the proper AquaTerm library symlinks exist by doing these checks:

ls /usr/local/lib/libaquaterm*
ls /usr/local/include/aquaterm/*

The first line above should return some *.dylib files, the second line above should return some *.h files, if they do not exist run these commands from terminal:

sudo ln -s /Library/Frameworks/AquaTerm.framework/Versions/A/AquaTerm /usr/local/lib/libaquaterm.dylib
sudo ln -s /Library/Frameworks/AquaTerm.framework/Versions/A/AquaTerm /usr/local/lib/libaquaterm.1.0.0.dylib
sudo ln -s /Library/Frameworks/AquaTerm.framework/Versions/A/Headers/* /usr/local/include/aquaterm/.

This is necessary sometimes as the installer for AquaTerm can't create the symlinks in the correct places due to permission issues. Once the /usr/local/ symlinks are created, reinstall gnuplot like this:

brew install gnuplot --with-aquaterm # (formerly --aquaterm in old versions)

Verify that gnuplot can see aquaterm using the steps below and happy plotting!


Verify: that gnuplot was configured with AquaTerm correctly by launching gnuplot in terminal

gnuplot

Type this in the gnuplot terminal

gnuplot> set term

Look for the line

Available terminal types:
         aqua  Interface to graphics terminal server for Mac OS X
         ...

If you see the that line above, then you are done, gnuplot is configured correctly and everybody's happy.

SapphireSun
  • 9,170
  • 11
  • 46
  • 59
mackuntu
  • 4,116
  • 1
  • 15
  • 8
  • Method 2 all the way! – Ben Miller Nov 09 '13 at 17:17
  • 2
    FYI: I didn't need to update the recipe for gnuplot; simply adding the symlinks prior to installing gnuplot did the trick. Looks like any problems on the Homebrew side of this have been fixed. Cheers! – Aron Dec 01 '13 at 06:45
  • 3
    `brew reinstall gnuplot --aquaterm` worked like a charm ... aquaterm must have already been installed at that point. – Pykler Jun 30 '14 at 07:11
  • 6
    with my setup, I had to `brew install gnuplot --with-aquaterm` ; apparently the brew gnuplot recipe for 4.6.6 uses '--with-aquaterm' now: no need to edit the recipe or create those symlinks, but you do need to explicitly add the --with-aquaterm when installing gnuplot. – Mike Sokolov Feb 15 '15 at 14:00
  • Thanks for great help...It worked well for me using 2nd method – minhas23 Mar 18 '16 at 06:00
  • Check rehumbus's answer below for a simpler solution that may avoid reinstalling. Simply add `setenv("GNUTERM","qt")` to `~/.octaverc` – laverick Dec 29 '17 at 03:08
47

I found a way to generate the plots with octave, although is not using AquaTerm but x11. The problem was that Octave was "forcing" gnuplot to use aquaterm to plot. Instead of installing and integrating aquaterm into gnuplot, in octave typed: setenv GNUTERM x11. With this, plots are generated with x11 which is already in the terminal list of gnuplot (set terminal). I know it's a patch, but finally I don't mind aquaterm or x11, I just want plots to be generated

PGreen
  • 3,239
  • 3
  • 24
  • 29
  • 1
    Thank you, your answer helped me after I tried at least half a dozen separate solutions – Kim Stacks Nov 10 '13 at 06:11
  • 2
    If running linux Mint 16 you might need to install gnuplot-x11. sudo apt-get install gnuplot-x11 Then do as PGreen said, I found that my conf file was at /etc/octave.conf. Hope that helps. – user1153623 Mar 03 '14 at 19:42
24

set terminal or set term is gnuplot command.

You just need to run gnuplot from command line to get access to the gnuplot shell.

However, this didn't work for me, neither did the setenv("GNUTERM","x11") in /usr/local/share/octave/site/m/startup/octaverc or ~/.octaverc (both do the same thing).

So I ran set term in gnuplot shell as saw no x11 in the list. I used homebrew to install gnuplot, so I first uninstalled it brew uninstall gnuplot, then installed with x11 using --with-x flag for that:

brew install gnuplot --with-x

This solved the issue for me. Use brew info gnuplot to see the list of flags for gnuplot installation.

P.S. And yes, I did download an X11 dmg and installed it using package installer, still gnuplot had no x11 in the list of supported terminals.

i4niac
  • 1,684
  • 1
  • 17
  • 20
  • 2
    Very helpful. Note that the graphics seem cleaner to me using the QT or WxWindows terminals, which can be installed (along side if desired) using the `--qt` and `--wx` brew install options respectively. – Bryan P Jun 21 '13 at 22:26
  • 1
    Instead of `brew install gnuplot --with-x`, use `brew reinstall gnuplot --with-x11` (if gnuplot is already installed; --with-x seems no longer supported) – Tushar Aug 15 '17 at 16:49
10

You can try this:

>> brew reinstall gnuplot --with-aquaterm

or

>> brew uninstall gnuplot
>> brew install gnuplot --with-aquaterm
antonpp
  • 2,333
  • 23
  • 28
8

Create a file .octaverc in your home directory and set GNUTERM to X11

echo "setenv('GNUTERM','X11')" > ~/.octaverc

Open octave terminal and type sombrero to check whether plotting works

octave:1> sombrero
behas
  • 3,386
  • 5
  • 27
  • 27
6

This worked for me:

  1. Unistall gnuplot

    brew uninstall gnuplot

  2. Install AquaTerm. You can download it from here: http://sourceforge.net/projects/aquaterm/

  3. Reinstall gnuplot

    brew install gnuplot

Community
  • 1
  • 1
avgn
  • 61
  • 1
  • 3
  • If you're still getting "Segmentation Fault: 11" and "unable to load appropriate font", these commands worked for me: `brew uninstall fontconfig` `&&` `brew install fontconfig --universal` – Julian Apr 19 '16 at 03:37
6

Anton is correct. You can now just reinstall gnuplot with the --with-aquaterm option. I'd upvote his answer if I had enough reputation points to do it.

$ brew uninstall gnuplot
$ brew install gnuplot --with-aquaterm

Mackuntu mentioned above that this issue has been discussed on github.

https://github.com/mxcl/homebrew/issues/14647#issuecomment-21132477

But he advised using the option --aquaterm. If you take a close look at the github link you'll see that the option is --with-aquaterm. Reinstalling gnuplot with this option today allowed me to run some old octave code that uses gnuplot for plotting graphs on OS X.

6

In my case, on Mas OS Mojave, the solution that worked for my was slightly different (it could be a matter of syntax only). Following the discussion on this thread I came with the solution that worked for me - it might be important to note that it was possible for me to plot from the Octave-cli but not from Octave command line directly in terminal.

So I created a ˜/.octaverc file and added the following command to it:

setenv GNUTERM qt

Just quit the command line from octave and entered again and was able to plot.

6

Following thing worked for me:

setenv("GNUTERM","qt")

You can either run it on the octave cli, for local run or can set in the octave startup file for permanent.

/usr/local/octave/3.8.0/share/octave/site/m/startup/octaverc

Just remember in case you change octaverc file you have to have write permissions on it.

Arjit Sharma
  • 416
  • 5
  • 15
5

I have an answer that should resolve the issue you're encountering. Essentially, for me the problem was that the gnuplot build did not locate the proper AquaTerm libraries. Check out the post I made:

http://deveneezer.blogspot.com/2013/06/octave-gnuplot-and-aquaterm.html

Yeison
  • 193
  • 3
  • 6
2

What has worked for me is installing gnuplot-nox. Also see https://bugs.mageia.org/show_bug.cgi?id=4866

Seems like the best way to install gnuplot-nox is to install fink. http://sourceforge.net/projects/fink/?source=dlp

fink install gnuplot-nox

seems to do a good job. However the installation was failing at one point. So I installed gnuplot-minimal then ran gnuplot-nox install again and everything worked just fine.

fink install gnuplot-minimal
fink install gnuplot-nox

gnuplot-nox install seemed to have set aqua as the default terminal for gnuplot. Verify that by going to gnuplot shell. To verify if plotting works, type plot(1) in the shell. It should show the plot in a window.

Hope that works for you.

Like suggested in other posts, setting GNUTERM to X11 didn't solve this issue for me. Also straight installing AquaTerm for Mac OSX didn't solve this issue.

2

The answer is already contained in the above, but this is simpler I think:

nano ~/.octaverc

add this:

setenv("GNUTERM", "X11")

Thats it restart octave you're done.

boulder_ruby
  • 38,457
  • 9
  • 79
  • 100
0

Here is the solution that worked for me (based on different parts of the mackuntu comment)

Gnuplot is probably already installed for you by the brew install octave command, so we need to remove it first

brew uninstall gnuplot

Then aquaterm has to be installed (http://sourceforge.net/projects/aquaterm/)

After install is complete you need to install gnuplot again. This is because brew detects the presence of aquaterm during install and will not do any checks for it after.

brew install gnuplot --with-aquaterm

If you launch gnuplot after install it should show that aquaterm is supported. And all graphics in octave will work.

can3p
  • 59
  • 4