Guilty Spark
Guilty Spark

Reputation: 89

Printing invisible figures in octave

I’m having a problem with printing figures in octave when the figure’s visibility is set to false. For example, the following code produces a “panic: segmentation fault” in Octave version 4.2.2:

t = 1:10;
fh = figure(“visible”, false);
plot(t,sin(t))
print(“fig.png”)

If I run the above code in Octave version 5.2.0, there is no problem. Is this a bug that was fixed in the Octave 5 update? If so, is there a workaround that I can use for Octave 4? I would prefer to use Octave 4 if possible.

Other notes: I am running this in Ubuntu 16.04.6 LTS and I installed octave 4 using apt.

Upvotes: 0

Views: 267

Answers (1)

Tasos Papastylianou
Tasos Papastylianou

Reputation: 22215

The answer to your question is, yes. Here is the relevant line from the v5.1.0 NEWS:

Dependencies:

  • The GUI requires Qt libraries. The minimum Qt4 version supported is Qt4.8. Qt5 of any version is preferred.
  • The OSMesa library is no longer used. To print invisible figures when using OpenGL graphics, the Qt QOFFSCREENSURFACE feature must be available and you must use the qt graphics toolkit.

Apparently the now deprecated OSMESA dependency and the printing of invisible figures was a long-standing pain-in-the-butt. Maybe you'll have some luck going through bug comments (e.g. someone says that if you make it visible at least once, it may be possible to print).

But as people have said in the comments, the best thing to do would be to upgrade your octave version, and recompile your mexfiles for the new version.

Upvotes: 2

Related Questions