Sunday, October 12, 2014

Getting plot to work in Octave OS X installation

I am new to Octave, and when I attempted to plot something using the plot() function, I was getting this error:

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

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

After some Google search and experimentation, here's the solution I found to work. You need to edit "octaverc" file in the following path:


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

(FYI, I have the version 3.8.0 above, so yours may be installed in a different folder.)

In that file, add this line at the end:


setenv("GNUTERM","qt")

Save the file, and that GNUTERM environment variable will be set every time you run octave. This works for OS X Maverick.

Others have also reported the following to work (instead):

setenv("GNUTERM","X11")

I suspect that works for folks who installed XQuartz, which is an X11 implementation for OS X that is no longer included in more recent versions of OS X.

Roy