Octave and Gnuplot in Mac
I know, I know, but trust me, I can’t stand waiting for the next post (about Nodejs and MongoDB) just to post a single yet easy-to-solve problem I have with Octave and Gnuplot in Mac.
If you have already knew about Matlab from MathWorks (and using it regularly), you probably need no introduction about Octave. Otherwise, I will tell you that Octave is similar, often called the free version of, Matlab. Read Octave’s explanation about itself.
Octave indeed a powerful tool when it comes to Mathematics. I can sum two matrices, inverse the result and transpose it. I can create any functions –cost function, optimal function, minimum function, almost anything– and solve them right away. The problem arise when I want to use the
Let me show you what I mean:
> x = linspace(-50, 50, 100);
> y = sin(x);
> plot(x, y);
as soon as I press the return key, Octave gave me this error message:
gnuplot> set terminal aqua enhanced title "Figure 1"
Linux users probably won’t see this kind of error (this is kind of my own hypothesis) but Mac users have a big opportunity seeing this as an error. After looking around and find out what’s going on, I came up with this simple solution.
> setenv("GNUTERM", "x11");
It seems that Mac has a non-standard terminal (which is “
aqua” in my case) and all I have to do is set the Octave environment to the standard terminal,
x11, and it works.