# HG changeset patch # User Ben Abbott # Date 1270943608 14400 # Node ID 424795ef82b8d1a072c1fdb31833166588531c8a # Parent bdf5d85cfc5ee05d194c2dcd18c8188dce484761 __go_draw_figure__.m: Don't set background for non-visible axes. diff --git a/scripts/ChangeLog b/scripts/ChangeLog --- a/scripts/ChangeLog +++ b/scripts/ChangeLog @@ -1,3 +1,7 @@ +2010-04-10 Ben Abbott + + * plot/__go_draw_figure__.m: Don't set background for non-visible axes. + 2010-04-07 John W. Eaton * testfun/runtests.m: New function. diff --git a/scripts/plot/__go_draw_figure__.m b/scripts/plot/__go_draw_figure__.m --- a/scripts/plot/__go_draw_figure__.m +++ b/scripts/plot/__go_draw_figure__.m @@ -77,44 +77,46 @@ bg_is_set = false; endif for i = nkids:-1:1 - type = get (kids(i), "type"); - switch (type) - case "axes" - ## Rely upon listener to convert axes position to "normalized" units. - orig_axes_units = get (kids(i), "units"); - orig_axes_position = get (kids(i), "position"); - unwind_protect - set (kids(i), "units", "normalized"); - fg = get (kids(i), "color"); - if (isnumeric (fg)) - fprintf (plot_stream, "set obj 2 rectangle from graph 0,0 to graph 1,1 behind fc rgb \"#%02x%02x%02x\"\n", 255 * fg); - fg_is_set = true; - else - fg_is_set = false; - endif - if (output_to_paper) - 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); - else - ## Return axes "units" and "position" back to their original values. - __go_draw_axes__ (kids(i), plot_stream, enhanced, mono, implicit_margin); - endif - unwind_protect_cleanup - set (kids(i), "units", orig_axes_units); - set (kids(i), "position", orig_axes_position); - 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); - endswitch + if (strcmp (get (kids(i), "visible"), "on")) + type = get (kids(i), "type"); + switch (type) + case "axes" + ## Rely upon listener to convert axes position to "normalized" units. + orig_axes_units = get (kids(i), "units"); + orig_axes_position = get (kids(i), "position"); + unwind_protect + set (kids(i), "units", "normalized"); + fg = get (kids(i), "color"); + if (isnumeric (fg)) + fprintf (plot_stream, "set obj 2 rectangle from graph 0,0 to graph 1,1 behind fc rgb \"#%02x%02x%02x\"\n", 255 * fg); + fg_is_set = true; + else + fg_is_set = false; + endif + if (output_to_paper) + 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); + else + ## Return axes "units" and "position" back to their original values. + __go_draw_axes__ (kids(i), plot_stream, enhanced, mono, implicit_margin); + endif + unwind_protect_cleanup + set (kids(i), "units", orig_axes_units); + set (kids(i), "position", orig_axes_position); + 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); + endswitch + endif endfor fputs (plot_stream, "\nunset multiplot;\n"); else