diff scripts/plot/surf.m @ 7215:dd88d61d443f

[project @ 2007-11-29 16:44:45 by jwe]
author jwe
date Thu, 29 Nov 2007 16:46:40 +0000
parents c7e5e638a8d0
children 5389a52df87b
line wrap: on
line diff
--- a/scripts/plot/surf.m
+++ b/scripts/plot/surf.m
@@ -31,16 +31,21 @@
 
 function h = surf (varargin)
 
-  newplot ();
+  [h, varargin] = __plt_get_axis_arg__ ("surf", varargin{:});
 
-  tmp = surface (varargin{:});
+  oldh = gca ();
+  unwind_protect
+    axes (h);
+    newplot ();
+    tmp = surface (varargin{:});
 
-  ax = get (tmp, "parent");
-
-  set (tmp, "facecolor", "flat");
-  if (! ishold ())
-    set (ax, "view", [-37.5, 30]);
-  endif
+    set (tmp, "facecolor", "flat");
+    if (! ishold ())
+      set (h, "view", [-37.5, 30]);
+    endif
+  unwind_protect_cleanup
+    axes (oldh);
+  end_unwind_protect
 
   if (nargout > 0)
     h = tmp;