changeset 22583:43fe18c1129e stable

Use gnuplot terminal background rather than draw text-obscuring rectangle (bug #49223). * __gnuplot_draw_figure__.m: Do not use rectangle for background, except for gnuplot's Qt terminal which has no 'background' option. Do the conditional inside gnuplot code rather than in Octave code. * __gnuplot_print__.m: Use figure 'color' property to set gnuplot terminal background color option.
author Daniel J Sebald <daniel.sebald@ieee.org>
date Sun, 02 Oct 2016 23:55:31 -0500
parents 0af4e27c50e0
children 2bca08793651
files scripts/plot/util/private/__gnuplot_draw_figure__.m scripts/plot/util/private/__gnuplot_print__.m
diffstat 2 files changed, 9 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/plot/util/private/__gnuplot_draw_figure__.m	Fri Sep 30 02:42:08 2016 -0500
+++ b/scripts/plot/util/private/__gnuplot_draw_figure__.m	Sun Oct 02 23:55:31 2016 -0500
@@ -38,10 +38,11 @@
       fputs (plot_stream, "set size 1, 1\n");
       bg = get (h, "color");
       if (isnumeric (bg))
-        fprintf (plot_stream, "set obj 1 rectangle from screen 0,0 to screen 1,1 behind fc rgb \"#%02x%02x%02x\" fs solid noborder\n", round (255 * bg));
+        fprintf (plot_stream, "if (GPVAL_TERM eq \"qt\") {set obj 1 rectangle from screen 0,0 to screen 1,1 behind fc rgb \"#%02x%02x%02x\" fs solid noborder}\n", round (255 * bg));
         bg_is_set = true;
       else
         bg_is_set = false;
+        fprintf (plot_stream, "unset obj 1");
       endif
       fg_was_set = false;
 
--- a/scripts/plot/util/private/__gnuplot_print__.m	Fri Sep 30 02:42:08 2016 -0500
+++ b/scripts/plot/util/private/__gnuplot_print__.m	Sun Oct 02 23:55:31 2016 -0500
@@ -45,6 +45,13 @@
   ## The axes-label and tick-label spacing is determined by
   ## the font spec given in "set terminal ..."
   gp_opts = font_spec (opts);
+  bg = get (opts.figure, "color");
+  if (isnumeric (bg))
+    gp_opts = sprintf ("%s background rgb \"#%02x%02x%02x\"",
+                       gp_opts, round (255 * bg));
+  else
+    gp_opts = sprintf ("%s nobackground", gp_opts);
+  endif
 
   pipeline = "";