changeset 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 8f28953882c2
children c3fd65712101
files scripts/ChangeLog scripts/plot/hold.m
diffstat 2 files changed, 16 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/ChangeLog
+++ b/scripts/ChangeLog
@@ -1,3 +1,8 @@
+2008-08-26  John W. Eaton  <jwe@octave.org>
+
+	* plot/hold.m: If hold is applied to a figure, set state for all
+	child axes objects.
+
 2008-08-22  John W. Eaton  <jwe@octave.org>
 
 	* statistics/distributions/chi2rnd.m: Fix missing semicolon.
--- a/scripts/plot/hold.m
+++ b/scripts/plot/hold.m
@@ -38,12 +38,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";
@@ -65,6 +68,11 @@
     print_usage ();
   endif
 
+  if (isfigure (h))
+    axes_objs = findobj (h, "type", "axes");
+    h = [h; axes_objs];
+  endif
+
   set (h, "nextplot", hold_state);
 
 endfunction