[Pkg-octave-devel] Bug#805295: octave: Plot to file without X display does not work

Mike Miller mtmiller at debian.org
Wed Nov 18 13:24:55 UTC 2015


On Mon, Nov 16, 2015 at 18:43:46 +0100, Djalil Chafai wrote:
> consider the following code stored in file plotest.m
> 
> # begin
> graphics_toolkit('gnuplot')
> set(0, 'defaultfigurevisible', 'off');
> plot(sin(1:100));
> print("plotest.jpg", "-djpg")
> # end
> 
> bash> export DISPLAY=
> bash> octave plotest.m
> 
> The image file plotest.jpg contains a fully black figure. It should not.

Agreed, this is due to an interaction between Octave and gnuplot v5.
Something different about gnuplot 5 causes the black fill area to be
drawn over all figures.

Since gnuplot is the only available toolkit when DISPLAY is not set,
there are a couple of (Debian-specific) workarounds to use gnuplot v4:

 * uninstall gnuplot5, gnuplot5-qt, etc. packages
 * use update-alternatives to set default gnuplot to be gnuplot v4
 * add "gnuplot_binary('gnuplot4')" to plotest.m

Another alternative is to use an X display, even a fake one if
necessary, with Xvnc or Xvfb for example.

  $ sed -i /graphics_toolkit/d plotest.m
  $ xvfb-run octave plotest.m

Upstream bug report for fixing interaction with gnuplot v5 is at
https://savannah.gnu.org/bugs/?42838.

-- 
mike



More information about the Pkg-octave-devel mailing list