1
votes

I'm trying to use the command plot(x,y,'rx') in octave. When I use it, a figure window opens up but I don't see any plot. It's just a blank white space. However, if I simply use the command plot(x,y) a figure window opens with a plot. I figured it had something to do with Octave not using the gnuplot toolkit and that I should use the command graphics_toolkit('gnuplot') to make Octave use gnuplot. Here's where the problem arises.

First of all Octave says that "gnuplot toolkit is not available". I very well know that I have it. I have used it before (not with Octave). I even removed the gnuplot and installed it once again after Octave said the toolkit wasn't available.

Searching for some answers on google, I realized I should add the line graphics_toolkit('gnuplot') at the end of the octaverc file. I didn't know where to find the file. Now, there were many answers that said that the octaverc file is in ~/.octaverc. But there is no such file in the ~/ directory. A few other answers suggested that we must create the file in such a scenario. At this point I'm unaware as to how I must 'create' a .octaverc file. So I copied it from /snap/octave/30/share/octave/5.2.0/site/m/startup and pasted in ~/, right clicked it, edited as administrator, added the line at the end of the file and saved the modified .octaverc file. Octave still says that "gnuplot toolkit is not available".
(I tried editing the .octaverc file in /snap/octave/30/share/octave/5.2.0/site/m/startup but it turned out to be a read-only file. I couldn't modify it no matter what I tried. Even as a root user I couldn't modify the file)

What do I do?

1
There's a few things that could be happening here. First, it may be that gnuplot was not detected when you first compiled octave, and similarly octave now has no way of knowing which gnuplot binary you're running. Secondly, it may be that your gnuplot installation isn't on the system path, so its binary cannot be found (or equally, the way you run octave doesn't export that path for octave to see). What is the output of gnuplot_binary from octave? - Tasos Papastylianou
check also the available_graphics_toolkits() output - matzeri
I am wondering if the problem is that you;re using snap instead of the system package manager. Why don't you just apt install octave? I'm guessing that snap isolates programs so its octave installatino won't be able to see the gnuplot program. - carandraug
@carandraug I did exactly that: installed from a snap, because apt provides Octave 4.4 and snap 5.2. I don't particularly care if it's snap or apt: any idea how I might get a working 5.2 install? :) - Tomislav Nakic-Alfirevic
@TomislavNakic-Alfirevic I don't know how to fix it on snap. If you want a more recent version than what apt provides, try building from source. You're on linux, which makes it quite simple. See wiki.octave.org/Octave_for_Debian_systems - carandraug

1 Answers

0
votes

I was able to solve it myself. Sorry for the delayed reply. The problem was due to it having been installed using Snap. The solution was to uninstall Octave and install it using apt.