# HG changeset patch # User John W. Eaton # Date 1219788313 14400 # Node ID 6333da0dfdfde7945fd8bfc13a36789358042027 # Parent 4f1ebb704545e5dba92380e98c020d3fe293eef4 hold.m: if hold is applied to a figure, set state for all child axes objects diff -r 4f1ebb704545 -r 6333da0dfdfd scripts/ChangeLog --- a/scripts/ChangeLog Tue Aug 26 16:39:17 2008 -0400 +++ b/scripts/ChangeLog Tue Aug 26 18:05:13 2008 -0400 @@ -1,3 +1,8 @@ +2008-08-26 John W. Eaton + + * plot/hold.m: If hold is applied to a figure, set state for all + child axes objects. + 2008-08-26 Michael Goffioul * plot/backend.m: New function to handle backend switch. diff -r 4f1ebb704545 -r 6333da0dfdfd scripts/plot/hold.m --- a/scripts/plot/hold.m Tue Aug 26 16:39:17 2008 -0400 +++ b/scripts/plot/hold.m Tue Aug 26 18:05:13 2008 -0400 @@ -44,12 +44,15 @@ function hold (varargin) - [h, varargin] = __plt_get_axis_arg__ ("hold", varargin{:}); + if (nargin > 0 && ishandle (varargin{1})) + [h, varargin, nargs] = __plt_get_axis_arg__ ("hold", varargin{:}); + else + h = gcf (); + nargs = numel (varargin); + endif hold_state = get (h, "nextplot"); - nargs = numel (varargin); - if (nargs == 0) if (strcmp (hold_state, "add")) hold_state = "replace"; @@ -71,6 +74,11 @@ print_usage (); endif + if (isfigure (h)) + axes_objs = findobj (h, "type", "axes"); + h = [h; axes_objs]; + endif + set (h, "nextplot", hold_state); endfunction