Mercurial > hg > octave-lyh
diff scripts/plot/hold.m @ 8065:6333da0dfdfd
hold.m: if hold is applied to a figure, set state for all child axes objects
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Tue, 26 Aug 2008 18:05:13 -0400 |
parents | 85c5c1d55820 |
children | a028a5960e18 |
line wrap: on
line diff
--- a/scripts/plot/hold.m +++ b/scripts/plot/hold.m @@ -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