changeset 10528:6a2e4e464d38

Unset figure color in __go_draw_axes__ (partial fix for bug #29060)
author David Bateman <dbateman@free.fr>
date Fri, 16 Apr 2010 17:36:28 +0200
parents b4d2080b6df7
children 7147078550fe
files scripts/ChangeLog scripts/plot/__go_draw_axes__.m scripts/plot/__go_draw_figure__.m
diffstat 3 files changed, 22 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/ChangeLog	Fri Apr 16 16:14:45 2010 +0200
+++ b/scripts/ChangeLog	Fri Apr 16 17:36:28 2010 +0200
@@ -1,5 +1,9 @@
 2010-04-16  David Bateman  <dbateman@free.fr>
 
+	* plot/__go_draw_figure__.m: Pass bg_is_set to __go_draw_axes__. Don't
+	unset the background figure color.
+	* plot/__go_draw_axes__.m: Unset the background figure color here.
+
 	* statistics/distributions/*: Replace constructs like "NaN * one()"
 	with "NaN()" and  "Inf * ones ()" with "Inf()".
 
--- a/scripts/plot/__go_draw_axes__.m	Fri Apr 16 16:14:45 2010 +0200
+++ b/scripts/plot/__go_draw_axes__.m	Fri Apr 16 17:36:28 2010 +0200
@@ -23,9 +23,9 @@
 
 ## Author: jwe
 
-function __go_draw_axes__ (h, plot_stream, enhanced, mono, implicit_margin)
+function __go_draw_axes__ (h, plot_stream, enhanced, mono, implicit_margin, bg_is_set)
 
-  if (nargin >= 4 && nargin <= 5)
+  if (nargin >= 4 && nargin <= 6)
 
     showhiddenhandles = get (0, "showhiddenhandles");
     unwind_protect
@@ -1551,10 +1551,18 @@
 	elseif (is_image_data (i))
 	  if (! is_image_data (i-1))
 	    fputs (plot_stream, "; ");
+            if (bg_is_set)      
+              fputs (plot_stream, "unset obj 1; \\\n");
+              bg_is_set = false;
+            endif
 	  endif
           fprintf (plot_stream, "%s \"-\" %s %s %s \\\n", plot_cmd,
 		   usingclause{i}, titlespec{i}, withclause{i});
 	elseif (is_image_data (i-1))
+          if (bg_is_set)      
+            fputs (plot_stream, "unset obj 1; \\\n");
+              bg_is_set = false;
+            endif
 	  fprintf (plot_stream, "%s \"-\" binary format='%%float64' %s %s %s \\\n", plot_cmd,
 		   usingclause{i}, titlespec{i}, withclause{i});
 	else
@@ -1593,6 +1601,11 @@
     if (view_map)
       fputs (plot_stream, "unset view;\n");
     endif
+    
+    if (bg_is_set)      
+      fputs (plot_stream, "unset obj 1;\n");
+      bg_is_set = false;
+    endif
 
     fflush (plot_stream);
 
--- a/scripts/plot/__go_draw_figure__.m	Fri Apr 16 16:14:45 2010 +0200
+++ b/scripts/plot/__go_draw_figure__.m	Fri Apr 16 17:36:28 2010 +0200
@@ -97,21 +97,18 @@
                     axes_position_on_page = orig_axes_position .* paper_position([3, 4, 3 ,4]);
                     axes_position_on_page(1:2) = axes_position_on_page(1:2) +  paper_position(1:2);
                     set (kids(i), "position", axes_position_on_page);
-                    __go_draw_axes__ (kids(i), plot_stream, enhanced, mono, implicit_margin);
+                    __go_draw_axes__ (kids(i), plot_stream, enhanced, mono, implicit_margin, bg_is_set);
                   else
                     ## Return axes "units" and "position" back to their original values.
-                    __go_draw_axes__ (kids(i), plot_stream, enhanced, mono, implicit_margin);
+                    __go_draw_axes__ (kids(i), plot_stream, enhanced, mono, implicit_margin, bg_is_set);
                   endif
                   unwind_protect_cleanup
                   set (kids(i), "units", orig_axes_units);
                   set (kids(i), "position", orig_axes_position);
+                  bg_is_set = false;
                   if (fg_is_set)
                     fputs (plot_stream, "unset obj 2\n");
                   endif
-                  if (bg_is_set)
-                    fputs (plot_stream, "unset obj 1\n");
-                    bg_is_set = false;
-                  endif
                 end_unwind_protect
               otherwise
                 error ("__go_draw_figure__: unknown object class, %s", type);