Spread the love

Here is the command that I tried to plot in Octave;

w = -6 - sqrt(10) * (rand(1,10000))
hist(w)

and this was the error that I got;

error: __init_gnuplot__: the gnuplot program is not available, see 'gnuplot_binary'
error: called from
    graphics_toolkit at line 85 column 5
    figure at line 86 column 7
    gcf at line 63 column 9
    gca at line 56 column 7
    hist at line 174 column 11
error: failed to load gnuplot graphics toolkit
error: called from
    figure at line 86 column 7
    gcf at line 63 column 9
    gca at line 56 column 7
    hist at line 174 column 11
error: base_graphics_toolkit::initialize: invalid graphics toolkit
error: called from
    figure at line 86 column 7
    gcf at line 63 column 9
    gca at line 56 column 7
    hist at line 174 column 11
error: evaluating argument list element number 1
error: called from
    gca at line 56 column 7
    hist at line 174 column 11

Then, I created .octaverc file in my home directory with the following content.

setenv GNUTERM x11

After that, I rerun the hist(w) command in Octave, and this time it printed the following error;

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

Finally, I reinstalled the gnuplot package using homebrew with the following commands;

brew uninstall gnuplot
brew install gnuplot --with-aquaterm

After that restart octave and try to plot your function again. It should work fine.
If you face any problems please comment below.