comparison scripts/plot/hold.m @ 11824:965bb17961f0 release-3-0-x

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 a1dbe9d80eee
children 553874dbba84
comparison
equal deleted inserted replaced
11823:8f28953882c2 11824:965bb17961f0
36 36
37 ## PKG_ADD: mark_as_command hold 37 ## PKG_ADD: mark_as_command hold
38 38
39 function hold (varargin) 39 function hold (varargin)
40 40
41 [h, varargin] = __plt_get_axis_arg__ ("hold", varargin{:}); 41 if (nargin > 0 && ishandle (varargin{1}))
42 [h, varargin, nargs] = __plt_get_axis_arg__ ("hold", varargin{:});
43 else
44 h = gcf ();
45 nargs = numel (varargin);
46 endif
42 47
43 hold_state = get (h, "nextplot"); 48 hold_state = get (h, "nextplot");
44
45 nargs = numel (varargin);
46 49
47 if (nargs == 0) 50 if (nargs == 0)
48 if (strcmp (hold_state, "add")) 51 if (strcmp (hold_state, "add"))
49 hold_state = "replace"; 52 hold_state = "replace";
50 else 53 else
63 endif 66 endif
64 else 67 else
65 print_usage (); 68 print_usage ();
66 endif 69 endif
67 70
71 if (isfigure (h))
72 axes_objs = findobj (h, "type", "axes");
73 h = [h; axes_objs];
74 endif
75
68 set (h, "nextplot", hold_state); 76 set (h, "nextplot", hold_state);
69 77
70 endfunction 78 endfunction