Plots in octave don't work

Joined
Apr 3, 2011
Messages
10
Reaction score
0
Points
1
I need help with this one. I've installed octave using macports. Installing all the dependencies took about 3-4 hours, and it also gave an error in installing qrupdate (library for fast updates of QR and Cholesky decompositions). I searched for a patch to the portfile on the macports forums, found one, installed qrupdate, then installed octave.

This was only text-based, so I also installed octave-general, octave-plot, octave-zenity, and qtoctave-mac, in that order.

if I open octave, or qtoctave-mac , I cannot plot anything because plots don't open. e.g.
> x = linspace(0,5); plot(x,sin(x))
gives nothing.

Any advice?
steviep
 
OP
S
Joined
Apr 3, 2011
Messages
10
Reaction score
0
Points
1
I've made some progress on my question. I've found the following in octave:
Code:
> getenv("GNUTERM")
ans =
This website gave a solution:
Octave - Bugs - plot commands do not work for octave on Mac OS X 10.6.2

Code:
> setenv("GNUTERM","X11")
> getenv("GNUTERM")
ans = X11

Then
Code:
> x=linspace(0,5); plot(x,sin(x))
works, and the plot opens up.

-So is there a way to have these commands executed every time octave opens, so plots work by default?

steviep
 
OP
S
Joined
Apr 3, 2011
Messages
10
Reaction score
0
Points
1
OK, according to this site:
Octave - Invoking Octave


When Octave starts, it looks for commands to execute from the following files:

OCTAVE_HOME/share/octave/site/m/startup/octaverc
Where OCTAVE_HOME is the directory in which all of Octave is installed (the default is `/usr/local'). This file is provided so that changes to the default Octave environment can be made globally for all users at your site for all versions of Octave you have installed. Some care should be taken when making changes to this file, since all users of Octave at your site will be affected.
OCTAVE_HOME/share/octave/VERSION/m/startup/octaverc
Where OCTAVE_HOME is the directory in which all of Octave is installed (the default is `/usr/local'), and VERSION is the version number of Octave. This file is provided so that changes to the default Octave environment can be made globally for all users for a particular version of Octave. Some care should be taken when making changes to this file, since all users of Octave at your site will be affected.
~/.octaverc
This file is normally used to make personal changes to the default Octave environment.
.octaverc
This file can be used to make changes to the default Octave environment for a particular project. Octave searches for this file in the current directory after it reads `~/.octaverc'. Any use of the cd command in the `~/.octaverc' file will affect the directory that Octave searches for the file `.octaverc'. If you start Octave in your home directory, commands from from the file `~/.octaverc' will only be executed once.

So I made a ~/.octaverc file that contains the following:
Code:
## commands executed on startup
setenv("GNUTERM","X11")


--Plots seem to work fine now. Can anyone comment if this is the best (or appropriate) solution?
 
Joined
Oct 24, 2013
Messages
1
Reaction score
0
Points
1
Thanks!

Thank you for the post. I was having the same problem and was able to fix it by adding the "setenv("GNUTERM","X11")" command to my octaverc file, though in my case, I have a package install of Octave, so I had to right-click on the application and show the package contents in order to find the file.
 

Shop Amazon


Shop for your Apple, Mac, iPhone and other computer products on Amazon.
We are a participant in the Amazon Services LLC Associates Program, an affiliate program designed to provide a means for us to earn fees by linking to Amazon and affiliated sites.
Top