# HG changeset patch # User Pantxo Diribarne # Date 1425219028 -3600 # Node ID f25fe53690225633417c783208dbfd1673d93379 # Parent 2350fc8ba960eebf7aeffbc37ddb275a5e64058e Don't assume axes parent is a figure (bug #44394) * axis.m: use "ancestor (ca, "figure")" in place of "get (ca, "parent")" * legend.m: use "ancestor (ca, "figure")" in place of "get (ca, "parent")" * colorbar.m: use "ancestor (ca, "figure")" in place of "get (ca, "parent")" * copyobj.m: use "ancestor (ca, "figure")" in place of "get (ca, "parent")" * hold.m: use "ancestor (ca, "figure")" in place of "get (ca, "parent")" * ishold.m: use "ancestor (ca, "figure")" in place of "get (ca, "parent")" diff -r 2350fc8ba960 -r f25fe5369022 scripts/plot/appearance/axis.m --- a/scripts/plot/appearance/axis.m Sat Feb 28 19:07:48 2015 -0500 +++ b/scripts/plot/appearance/axis.m Sun Mar 01 15:10:28 2015 +0100 @@ -193,7 +193,7 @@ set (ca, "dataaspectratiomode", "auto", "plotboxaspectratio", [1, 1, 1]); elseif (strcmp (ax, "equal")) - if (strcmp (get (get (ca, "parent"), "__graphics_toolkit__"), "gnuplot")) + if (strcmp (get (ancestor (ca, "figure"), "__graphics_toolkit__"), "gnuplot")) ## FIXME: gnuplot applies the aspect ratio activepostionproperty. set (ca, "activepositionproperty", "position"); ## The following line is a trick used to trigger the recalculation of diff -r 2350fc8ba960 -r f25fe5369022 scripts/plot/appearance/legend.m --- a/scripts/plot/appearance/legend.m Sat Feb 28 19:07:48 2015 -0500 +++ b/scripts/plot/appearance/legend.m Sun Mar 01 15:10:28 2015 +0100 @@ -125,7 +125,7 @@ if (isempty (ca)) ca = gca (); endif - fig = get (ca, "parent"); + fig = ancestor (ca, "figure"); else fig = get (0, "currentfigure"); if (isempty (fig)) diff -r 2350fc8ba960 -r f25fe5369022 scripts/plot/draw/colorbar.m --- a/scripts/plot/draw/colorbar.m Sat Feb 28 19:07:48 2015 -0500 +++ b/scripts/plot/draw/colorbar.m Sun Mar 01 15:10:28 2015 +0100 @@ -149,7 +149,7 @@ ## if (! isempty (args)) ## set (hcb, args{:}); ## endif - ax = get (get (hcb, "parent"), "currrentaxes"); + ax = get (ancestor (hcb, "figure"), "currrentaxes"); endif endif @@ -163,7 +163,7 @@ showhiddenhandles = get (0, "showhiddenhandles"); unwind_protect set (0, "showhiddenhandles", "on"); - cax = findobj (get (ax, "parent"), + cax = findobj (ancestor (ax, "figure"), "tag", "colorbar", "type", "axes", "axes", ax); if (! isempty (cax)) delete (cax); @@ -180,8 +180,8 @@ obj = get (ax); obj.__cbar_hax__ = ax; position = obj.position; - ## FIXME: Should this be ancestor to accommodate hggroups? - hpar = get (ax, "parent"); + + hpar = ancestor (ax, "figure"); clen = rows (get (hpar, "colormap")); cext = get (ax, "clim"); cdiff = (cext(2) - cext(1)) / clen / 2; @@ -277,7 +277,7 @@ function resetaxis (cax, d, ax, orig_props) if (isaxes (ax)) ## FIXME: Probably don't want to delete everyone's listeners on colormap. - dellistener (get (ax, "parent"), "colormap"); + dellistener (ancestor (ax, "figure"), "colormap"); dellistener (ax, "clim"); dellistener (ax, "dataaspectratio"); dellistener (ax, "dataaspectratiomode"); @@ -297,7 +297,7 @@ function update_colorbar_clim (hax, d, hi, vert) if (isaxes (hax) && (isempty (gcbf ()) || strcmp (get (gcbf (), "beingdeleted"), "off"))) - clen = rows (get (get (hax, "parent"), "colormap")); + clen = rows (get (ancestor (hax, "figure"), "colormap")); cext = get (hax, "clim"); cdiff = (cext(2) - cext(1)) / clen / 2; cmin = cext(1) + cdiff; diff -r 2350fc8ba960 -r f25fe5369022 scripts/plot/util/copyobj.m --- a/scripts/plot/util/copyobj.m Sat Feb 28 19:07:48 2015 -0500 +++ b/scripts/plot/util/copyobj.m Sun Mar 01 15:10:28 2015 +0100 @@ -65,7 +65,7 @@ ## reset current figure (and eventually axes) to original set (0, "currentfigure", cf); - if (get (hnew, "parent") == cf && ! isempty (ca)) + if (ancestor (hnew, "figure") == cf && ! isempty (ca)) set (cf, "currentaxes", ca) endif diff -r 2350fc8ba960 -r f25fe5369022 scripts/plot/util/hold.m --- a/scripts/plot/util/hold.m Sat Feb 28 19:07:48 2015 -0500 +++ b/scripts/plot/util/hold.m Sun Mar 01 15:10:28 2015 +0100 @@ -56,9 +56,8 @@ if (nargin > 0 && isscalar (varargin{1}) && isaxes (varargin{1})) hax = varargin{1}; varargin(1) = []; - nargs = numel (varargin); - ## FIXME: Should this be ancestor (hax, "parent")? - hfig = get (hax, "parent"); + nargs = numel (varargin); + hfig = ancestor (hax, "figure"); elseif (nargin > 0 && numel (varargin{1}) > 1 && ishandle (varargin{1})) print_usage (); else diff -r 2350fc8ba960 -r f25fe5369022 scripts/plot/util/ishold.m --- a/scripts/plot/util/ishold.m Sat Feb 28 19:07:48 2015 -0500 +++ b/scripts/plot/util/ishold.m Sun Mar 01 15:10:28 2015 +0100 @@ -44,7 +44,7 @@ ax = get (fig, "currentaxes"); elseif (strcmp (get (h, "type"), "axes")) ax = h; - fig = get (ax, "parent"); + fig = ancestor (ax, "figure"); else error ("ishold: H must be an axes or figure graphics handle"); endif