# HG changeset patch # User Ben Abbott # Date 1283983179 14400 # Node ID 9c0b366583cb4d6b5af8ca2645316a5025e09783 # Parent 18b0af0bbd6b25c91936ca2bd3c4040f6337d773 Revert treatment of activepositionproperty from the gnuplot backend. diff -r 18b0af0bbd6b -r 9c0b366583cb scripts/ChangeLog --- a/scripts/ChangeLog Wed Sep 08 08:17:48 2010 -0400 +++ b/scripts/ChangeLog Wed Sep 08 17:59:39 2010 -0400 @@ -1,5 +1,8 @@ 2010-09-08 Ben Abbott + * plot/colorbar.m, plot/axis.m, + plot/private/__actual_axis_position__.m, plot/__go_draw_axes__.m: + Revert treatment of activepositionproperty from the gnuplot backend. * image/image.m: Fix axis limits for single dimension images, add demo. diff -r 18b0af0bbd6b -r 9c0b366583cb scripts/plot/__go_draw_axes__.m --- a/scripts/plot/__go_draw_axes__.m Wed Sep 08 08:17:48 2010 -0400 +++ b/scripts/plot/__go_draw_axes__.m Wed Sep 08 17:59:39 2010 -0400 @@ -77,53 +77,42 @@ dr = 1; endif - if (strcmp (axis_obj.activepositionproperty, "position")) - if (__gnuplot_has_feature__ ("screen_coordinates_for_{lrtb}margin")) - if (nd == 2 || all (mod (axis_obj.view, 90) == 0)) - x = [1, 1]; - else - ## 3D plots need to be sized down to fit in the window. - x = 1.0 ./ sqrt([2, 2.5]); - endif - fprintf (plot_stream, "set tmargin screen %.15g;\n", - pos(2)+pos(4)/2+x(2)*pos(4)/2); - fprintf (plot_stream, "set bmargin screen %.15g;\n", - pos(2)+pos(4)/2-x(2)*pos(4)/2); - fprintf (plot_stream, "set lmargin screen %.15g;\n", - pos(1)+pos(3)/2-x(1)*pos(3)/2); - fprintf (plot_stream, "set rmargin screen %.15g;\n", - pos(1)+pos(3)/2+x(1)*pos(3)/2); - sz_str = ""; + if (__gnuplot_has_feature__ ("screen_coordinates_for_{lrtb}margin")) + if (nd == 2 || all (mod (axis_obj.view, 90) == 0)) + x = [1, 1]; else - fprintf (plot_stream, "set tmargin 0;\n"); - fprintf (plot_stream, "set bmargin 0;\n"); - fprintf (plot_stream, "set lmargin 0;\n"); - fprintf (plot_stream, "set rmargin 0;\n"); + ## 3D plots need to be sized down to fit in the window. + x = 1.0 ./ sqrt([2, 2.5]); + endif + fprintf (plot_stream, "set tmargin screen %.15g;\n", + pos(2)+pos(4)/2+x(2)*pos(4)/2); + fprintf (plot_stream, "set bmargin screen %.15g;\n", + pos(2)+pos(4)/2-x(2)*pos(4)/2); + fprintf (plot_stream, "set lmargin screen %.15g;\n", + pos(1)+pos(3)/2-x(1)*pos(3)/2); + fprintf (plot_stream, "set rmargin screen %.15g;\n", + pos(1)+pos(3)/2+x(1)*pos(3)/2); + sz_str = ""; + else + fprintf (plot_stream, "set tmargin 0;\n"); + fprintf (plot_stream, "set bmargin 0;\n"); + fprintf (plot_stream, "set lmargin 0;\n"); + fprintf (plot_stream, "set rmargin 0;\n"); - if (nd == 3 && all (axis_obj.view == [0, 90])) - ## FIXME -- Kludge to allow colorbar to be added to a pcolor() plot - pos(3:4) = pos(3:4) * 1.4; - pos(1:2) = pos(1:2) - pos(3:4) * 0.125; - endif - - fprintf (plot_stream, "set origin %.15g, %.15g;\n", pos(1), pos(2)); - - if (strcmpi (axis_obj.dataaspectratiomode, "manual")) - sz_str = sprintf ("set size ratio %.15g", -dr); - else - sz_str = "set size noratio"; - endif - sz_str = sprintf ("%s %.15g, %.15g;\n", sz_str, pos(3), pos(4)); + if (nd == 3 && all (axis_obj.view == [0, 90])) + ## FIXME -- Kludge to allow colorbar to be added to a pcolor() plot + pos(3:4) = pos(3:4) * 1.4; + pos(1:2) = pos(1:2) - pos(3:4) * 0.125; endif - else ## activepositionproperty == outerposition - fprintf (plot_stream, "set origin %g, %g;\n", pos(1:2)) - sz_str = ""; + + fprintf (plot_stream, "set origin %.15g, %.15g;\n", pos(1), pos(2)); + if (strcmpi (axis_obj.dataaspectratiomode, "manual")) - sz_str = sprintf ("ratio %g", -dr); + sz_str = sprintf ("set size ratio %.15g", -dr); else - sz_str = "noratio"; + sz_str = "set size noratio"; endif - sz_str = sprintf ("set size %s %g, %g;\n", sz_str, pos(3:4)); + sz_str = sprintf ("%s %.15g, %.15g;\n", sz_str, pos(3), pos(4)); endif if (! isempty (sz_str)) fputs (plot_stream, sz_str); diff -r 18b0af0bbd6b -r 9c0b366583cb scripts/plot/axis.m --- a/scripts/plot/axis.m Wed Sep 08 08:17:48 2010 -0400 +++ b/scripts/plot/axis.m Wed Sep 08 17:59:39 2010 -0400 @@ -184,10 +184,6 @@ elseif (strcmp (ax, "equal")) x = xlim; y = ylim; - if (strcmp (get (get (ca, "parent"), "__backend__"), "gnuplot")) - ## FIXME - gnuplot applies the aspect ratio activepostionproperty. - set (ca, "activepositionproperty", "position"); - endif set (ca, "plotboxaspectratio", [(x(2)-x(1)), (y(2)-y(1)), 1]); elseif (strcmpi (ax, "normal")) set (ca, "plotboxaspectratio", [1, 1, 1]) diff -r 18b0af0bbd6b -r 9c0b366583cb scripts/plot/colorbar.m --- a/scripts/plot/colorbar.m Wed Sep 08 08:17:48 2010 -0400 +++ b/scripts/plot/colorbar.m Wed Sep 08 17:59:39 2010 -0400 @@ -271,13 +271,8 @@ else scale = [scale, 1]; endif - if (strcmp (obj.activepositionproperty, "position")) - obj.position = obj.position .* [1, 1, scale]; - off = 0.5 * (obj.position (3:4) - __actual_axis_position__ (obj)(3:4)); - else - obj.outerposition = obj.outerposition .* [1, 1, scale]; - off = 0.5 * (obj.outerposition (3:4) - __actual_axis_position__ (obj)(3:4)); - endif + obj.position = obj.position .* [1, 1, scale]; + off = 0.5 * (obj.position (3:4) - __actual_axis_position__ (obj)(3:4)); else off = 0.0; endif @@ -592,7 +587,6 @@ %! shading ("interp") %! axis ("tight", "square") %! colorbar () -#%! axes('color','none','box','on','activepositionproperty','position') %!demo %! clf diff -r 18b0af0bbd6b -r 9c0b366583cb scripts/plot/private/__actual_axis_position__.m --- a/scripts/plot/private/__actual_axis_position__.m Wed Sep 08 08:17:48 2010 -0400 +++ b/scripts/plot/private/__actual_axis_position__.m Wed Sep 08 17:59:39 2010 -0400 @@ -43,12 +43,8 @@ set (axis_obj.parent, "units", orig_fig_units) set (axis_obj.parent, "position", orig_fig_position) end_unwind_protect - ## Get axes size in pixels - if (strcmp (axis_obj.activepositionproperty, "position")) - pos_in_pixels = axis_obj.position .* fig_position([3, 4, 3, 4]); - else - pos_in_pixels = axis_obj.outerposition .* fig_position([3, 4, 3, 4]); - endif + ## Get axis plot-box size in pixels + pos_in_pixels = axis_obj.position .* fig_position([3, 4, 3, 4]); nd = __calc_dimensions__ (h); @@ -86,10 +82,8 @@ pos_in_pixels = pos_in_pixels + dy*[0.0, 0.5, 0.0, -1.0]; endif pos = pos_in_pixels ./ fig_position([3, 4, 3, 4]); - elseif (strcmp (axis_obj.activepositionproperty, "position")) + else pos = axis_obj.position; - else - pos = axis_obj.outerposition; endif endfunction