Mercurial > octave
changeset 28310:1379ebcb00c3
Replace uses of axes property "activepositionproperty" by "positionconstraint" (bug #58336).
* appearance/daspect.m, appearance/private/__gnuplot_legend__.m,
draw/colorbar.m, draw/plotyy.m, draw/semilogx.m, draw/semilogy.m,
util/__actual_axis_position__.m, util/private/__gnuplot_draw_axes__.m,
util/struct2hdl.m, util/subplot.m: Replace all uses of axes property
"activepositionproperty" (which is a hidden property now) by
"positionconstraint".
* graphics.in.h: Remove FIXME note.
author | Markus Mützel <markus.muetzel@gmx.de> |
---|---|
date | Mon, 18 May 2020 13:02:20 +0200 |
parents | a81b7b132c09 |
children | f9b5357f4a7e |
files | libinterp/corefcn/graphics.in.h scripts/plot/appearance/daspect.m scripts/plot/appearance/private/__gnuplot_legend__.m scripts/plot/draw/colorbar.m scripts/plot/draw/plotyy.m scripts/plot/draw/semilogx.m scripts/plot/draw/semilogy.m scripts/plot/util/__actual_axis_position__.m scripts/plot/util/private/__gnuplot_draw_axes__.m scripts/plot/util/struct2hdl.m scripts/plot/util/subplot.m |
diffstat | 11 files changed, 28 insertions(+), 29 deletions(-) [+] |
line wrap: on
line diff
--- a/libinterp/corefcn/graphics.in.h Mon May 18 18:10:39 2020 +0900 +++ b/libinterp/corefcn/graphics.in.h Mon May 18 13:02:20 2020 +0200 @@ -3737,7 +3737,6 @@ row_vector_property plotboxaspectratio mu , Matrix (1, 3, 1.0) radio_property plotboxaspectratiomode u , "{auto}|manual" array_property position u , default_axes_position () - // FIXME: "positionconstraint" should deprecate "activepositionproperty" radio_property positionconstraint , "{outerposition}|innerposition" radio_property projection , "{orthographic}|perspective" radio_property sortmethod , "{depth}|childorder"
--- a/scripts/plot/appearance/daspect.m Mon May 18 18:10:39 2020 +0900 +++ b/scripts/plot/appearance/daspect.m Mon May 18 13:02:20 2020 +0200 @@ -130,7 +130,7 @@ %! x = 0:0.01:4; %! plot (x,cos(x), x, sin(x)); %! axis square; -%! set (gca, "activepositionproperty", "position"); +%! set (gca, "positionconstraint", "innerposition"); %! daspect ([1 1 1]); %! title ("square plot box with axis limits [0, 4, -2, 2]"); @@ -139,7 +139,7 @@ %! x = 0:0.01:4; %! plot (x,cos(x), x,sin(x)); %! axis ([0 4 -1 1]); -%! set (gca, "activepositionproperty", "position"); +%! set (gca, "positionconstraint", "innerposition"); %! daspect ([2 1 1]); %! title ("square plot box with axis limits [0, 4, -1, 1]");
--- a/scripts/plot/appearance/private/__gnuplot_legend__.m Mon May 18 18:10:39 2020 +0900 +++ b/scripts/plot/appearance/private/__gnuplot_legend__.m Mon May 18 13:02:20 2020 +0200 @@ -622,7 +622,7 @@ "box", box, "xtick", [], "ytick", [], "xlim", [0, 1], "ylim", [0, 1], - "activepositionproperty", "position"); + "positionconstraint", "innerposition"); setappdata (hlegend, "__axes_handle__", ud); try addproperty ("__legend_handle__", ud(1), "handle", hlegend); @@ -1062,7 +1062,7 @@ ## This violates strict Matlab compatibility, but reliably ## renders an aesthetic result. set (ca(i), "position", unmodified_axes_position, - "activepositionproperty", "outerposition"); + "positionconstraint", "outerposition"); else ## numel (ca) > 1 for axes overlays (like plotyy) set (ca(i), "position", new_pos); @@ -1181,8 +1181,8 @@ outerposition = get (hleg, "unmodified_axes_outerposition"); units = get (hax, "units"); set (hax, "units", "points"); - switch (get (hax, "activepositionproperty")) - case "position" + switch (get (hax, "positionconstraint")) + case "innerposition" set (hax, "outerposition", outerposition, "position", position); case "outerposition" set (hax, "position", position, "outerposition", outerposition);
--- a/scripts/plot/draw/colorbar.m Mon May 18 18:10:39 2020 +0900 +++ b/scripts/plot/draw/colorbar.m Mon May 18 13:02:20 2020 +0200 @@ -219,7 +219,7 @@ set (hax, "units", orig_props.units, "position", orig_props.position, "outerposition", orig_props.outerposition, - "activepositionproperty", orig_props.activepositionproperty); + "positionconstraint", orig_props.positionconstraint); set (hax, "units", units); endif @@ -251,7 +251,7 @@ ## FIXME: Matlab does not require the "position" property to be active. ## Is there a way to determine the plotbox position for the ## gnuplot graphics toolkit when the outerposition is active? - set (hax, "activepositionproperty", "position"); + set (hax, "positionconstraint", "innerposition"); props = get (hax); props.__axes_handle__ = hax; position = props.position; @@ -276,7 +276,7 @@ ## Create colorbar axes if necessary if (new_colorbar) hcb = axes ("parent", hpar, "tag", "colorbar", - "activepositionproperty", "position", "position", cbpos, + "positionconstraint", "innerposition", "position", cbpos, "colormap", cmap, "box", "on", "xdir", "normal", "ydir", "normal"); @@ -438,7 +438,7 @@ set (hax, "units", orig_props.units, "position", orig_props.position, "outerposition", orig_props.outerposition, - "activepositionproperty", orig_props.activepositionproperty); + "positionconstraint", orig_props.positionconstraint); set (hax, "units", units); ## Nullify colorbar link (can't delete properties yet) @@ -534,7 +534,7 @@ scale = [scale, 1]; endif if (strcmp (get (cf, "__graphics_toolkit__"), "gnuplot") - && strcmp (props.activepositionproperty, "outerposition")) + && strcmp (props.positionconstraint, "outerposition")) props.outerposition = props.outerposition .* [1, 1, scale]; off = 0.5 * (props.outerposition (3:4) - __actual_axis_position__ (props)(3:4)); else @@ -884,7 +884,7 @@ %! shading interp; %! axis ("tight", "square"); %! colorbar (); -#%! axes ("color","none","box","on","activepositionproperty","position"); +#%! axes ("color", "none", "box", "on", "positionconstraint", "innerposition"); %!demo %! clf;
--- a/scripts/plot/draw/plotyy.m Mon May 18 18:10:39 2020 +0900 +++ b/scripts/plot/draw/plotyy.m Mon May 18 13:02:20 2020 +0200 @@ -136,9 +136,9 @@ if (strcmp (get (ax(1), "__autopos_tag__"), "subplot")) set (ax(2), "__autopos_tag__", "subplot"); elseif (strcmp (graphics_toolkit (), "gnuplot")) - set (ax, "activepositionproperty", "position"); + set (ax, "positionconstraint", "innerposition"); else - set (ax, "activepositionproperty", "outerposition"); + set (ax, "positionconstraint", "outerposition"); endif ## Don't replace axis which has colororder property already modified @@ -154,7 +154,7 @@ set (ax(2), "ycolor", getcolor (h2)); endif - if (strcmp (get(ax(1), "activepositionproperty"), "position")) + if (strcmp (get(ax(1), "positionconstraint"), "innerposition")) set (ax(2), "position", get (ax(1), "position")); else set (ax(2), {"outerposition", "looseinset"},
--- a/scripts/plot/draw/semilogx.m Mon May 18 18:10:39 2020 +0900 +++ b/scripts/plot/draw/semilogx.m Mon May 18 13:02:20 2020 +0200 @@ -104,12 +104,12 @@ %! %! subplot (1,2,1); %! semilogx (x, y); -%! set (gca, "xdir", "reverse", "activepositionproperty", "outerposition"); +%! set (gca, "xdir", "reverse", "positionconstraint", "outerposition"); %! title ({"semilogx (x, y)", "xdir = reversed"}); %! %! subplot (1,2,2); %! semilogx (-x, y); -%! set (gca, "xdir", "reverse", "activepositionproperty", "outerposition"); +%! set (gca, "xdir", "reverse", "positionconstraint", "outerposition"); %! title ({"semilogx (-x, y)", "xdir = reversed"}); %!test
--- a/scripts/plot/draw/semilogy.m Mon May 18 18:10:39 2020 +0900 +++ b/scripts/plot/draw/semilogy.m Mon May 18 13:02:20 2020 +0200 @@ -104,12 +104,12 @@ %! %! subplot (2,1,1); %! semilogy (x, y); -%! set (gca, "ydir", "reverse", "activepositionproperty", "outerposition"); +%! set (gca, "ydir", "reverse", "positionconstraint", "outerposition"); %! title ({"semilogy (x, y)", "ydir = reversed"}); %! %! subplot (2,1,2); %! semilogy (x, -y); -%! set (gca, "ydir", "reverse", "activepositionproperty", "outerposition"); +%! set (gca, "ydir", "reverse", "positionconstraint", "outerposition"); %! title ({"semilogy (x, -y)", "ydir = reversed"}); %!test
--- a/scripts/plot/util/__actual_axis_position__.m Mon May 18 18:10:39 2020 +0900 +++ b/scripts/plot/util/__actual_axis_position__.m Mon May 18 13:02:20 2020 +0200 @@ -50,7 +50,7 @@ end_unwind_protect ## Get axes size in pixels if (strcmp (get (axis_obj.parent, "__graphics_toolkit__"), "gnuplot") - && strcmp (axis_obj.activepositionproperty, "outerposition")) + && strcmp (axis_obj.positionconstraint, "outerposition")) pos_in_pixels = axis_obj.outerposition .* fig_position([3, 4, 3, 4]); else pos_in_pixels = axis_obj.position .* fig_position([3, 4, 3, 4]); @@ -82,7 +82,7 @@ endif pos = pos_in_pixels ./ fig_position([3, 4, 3, 4]); elseif (strcmp (get (axis_obj.parent, "__graphics_toolkit__"), "gnuplot") - && strcmp (axis_obj.activepositionproperty, "outerposition")) + && strcmp (axis_obj.positionconstraint, "outerposition")) pos = axis_obj.outerposition; else pos = axis_obj.position;
--- a/scripts/plot/util/private/__gnuplot_draw_axes__.m Mon May 18 18:10:39 2020 +0900 +++ b/scripts/plot/util/private/__gnuplot_draw_axes__.m Mon May 18 13:02:20 2020 +0200 @@ -87,7 +87,7 @@ dr = 1; endif - if (strcmp (axis_obj.activepositionproperty, "position")) + if (strcmp (axis_obj.positionconstraint, "innerposition")) if (nd == 2 || all (mod (axis_obj.view, 90) == 0)) x = [1, 1]; else @@ -103,7 +103,7 @@ fprintf (plot_stream, "set rmargin screen %.15g;\n", pos(1)+pos(3)/2+x(1)*pos(3)/2); sz_str = ""; - else ## activepositionproperty == outerposition + else ## positionconstraint == outerposition fprintf (plot_stream, "unset tmargin;\n"); fprintf (plot_stream, "unset bmargin;\n"); fprintf (plot_stream, "unset lmargin;\n");
--- a/scripts/plot/util/struct2hdl.m Mon May 18 18:10:39 2020 +0900 +++ b/scripts/plot/util/struct2hdl.m Mon May 18 13:02:20 2020 +0200 @@ -108,11 +108,11 @@ ## change the mode to "manual" when the value is "auto". names = fieldnames (s.properties); n = strncmp (cellfun (@fliplr, names, "uniformoutput", false), "edom", 4); - n = (n | strcmp (names, "activepositionproperty")); + n = (n | strcmp (names, "positionconstraint")); names = [names(! n); names(n)]; n_pos = find (strcmp (names, "position") | strcmp (names, "outerposition")); if (strcmp (s.type, "axes") && numel (n_pos) == 2) - if (strcmp (s.properties.activepositionproperty, "position")) + if (strcmp (s.properties.positionconstraint, "innerposition")) names{n_pos(1)} = "outerposition"; names{n_pos(2)} = "position"; else
--- a/scripts/plot/util/subplot.m Mon May 18 18:10:39 2020 +0900 +++ b/scripts/plot/util/subplot.m Mon May 18 13:02:20 2020 +0200 @@ -211,7 +211,7 @@ set (cf, "units", "pixels"); ## FIXME: At the moment we force gnuplot to use the aligned mode - ## which will set "activepositionproperty" to "position". + ## which will set "positionconstraint" to "innerposition". ## This can yield to text overlap between labels and titles. ## See bug #31610. if (strcmp (get (cf, "__graphics_toolkit__"), "gnuplot")) @@ -288,7 +288,7 @@ set (hsubplot, varargin{:}); endif else - pval = [{"activepositionproperty", "position", ... + pval = [{"positionconstraint", "innerposition", ... "position", pos, "looseinset", li} varargin]; if (! make_subplot) hsubplot = axes (pval{:}); @@ -445,7 +445,7 @@ endif for ii = 1:numel (hsubplots) set (hsubplots(ii), "outerposition", opos(ii,:), ... - "activepositionproperty", "position"); + "positionconstraint", "innerposition"); endfor ## Compare current positions to default and compute the new ones