changeset 8241:1e1e88bcc733

surfnorm.m: save and restore hold state
author John W. Eaton <jwe@octave.org>
date Mon, 20 Oct 2008 10:42:00 -0400
parents 5cfeb7bc497a
children a9d3b88ea6fb
files scripts/ChangeLog scripts/plot/surfnorm.m
diffstat 2 files changed, 16 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/ChangeLog	Mon Oct 20 10:31:17 2008 -0400
+++ b/scripts/ChangeLog	Mon Oct 20 10:42:00 2008 -0400
@@ -1,3 +1,9 @@
+2008-10-20  John W. Eaton  <jwe@octave.org>
+
+	* plot/surfnorm.m: Save and restore hold state.
+	From Daniel J. Sebald <daniel.sebald@ieee.org> and
+	Ben Abbott <bpabbott@mac.com>.
+
 2008-10-20  Ben Abbott  <bpabbott@mac.com>
 
 	* plot/__stem__.m: Respect new ordering of children when setting
--- a/scripts/plot/surfnorm.m	Mon Oct 20 10:31:17 2008 -0400
+++ b/scripts/plot/surfnorm.m	Mon Oct 20 10:42:00 2008 -0400
@@ -114,11 +114,16 @@
       axes (h);
       newplot ();
       surf (x, y, z, varargin{ioff:end});
-      hold on;
-      plot3 ([x(:)'; x(:).' + nx(:).' ; NaN(size(x(:).'))](:),
-	     [y(:)'; y(:).' + ny(:).' ; NaN(size(y(:).'))](:),
-	     [z(:)'; z(:).' + nz(:).' ; NaN(size(z(:).'))](:), 
-	     varargin{ioff:end});
+      old_hold_state = get (h, "nextplot");
+      unwind_protect
+	set (h, "nextplot", "add");
+	plot3 ([x(:)'; x(:).' + nx(:).' ; NaN(size(x(:).'))](:),
+	       [y(:)'; y(:).' + ny(:).' ; NaN(size(y(:).'))](:),
+	       [z(:)'; z(:).' + nz(:).' ; NaN(size(z(:).'))](:), 
+	       varargin{ioff:end});
+      unwind_protect_cleanup
+	set (h, "nextplot", old_hold_state);
+      end_unwind_protect
     unwind_protect_cleanup
       axes (oldh);
     end_unwind_protect