diff scripts/plot/ellipsoid.m @ 17051:3e1b24a2454a

cylinder.m, ellipsoid.m, rectangle.m, sphere.m: Update to use new __plt_get_axis_arg__. * scripts/plot/cylinder.m, scripts/plot/ellipsoid.m, scripts/plot/rectangle.m, scripts/plot/sphere.m: Update to use new __plt_get_axis_arg__. Rename ax to hax.
author Pantxo Diribarne <pantxo.diribarne@gmail.com>
date Tue, 23 Jul 2013 16:06:07 +0200
parents 11949c9795a0
children eaab03308c0b
line wrap: on
line diff
--- a/scripts/plot/ellipsoid.m
+++ b/scripts/plot/ellipsoid.m
@@ -31,8 +31,7 @@
 
 function [xx, yy, zz] = ellipsoid (varargin)
 
-  [h, varargin, nargin] = __plt_get_axis_arg__ ((nargout > 0), "ellipsoid",
-                                                varargin{:});
+  [hax, varargin, nargin] = __plt_get_axis_arg__ ("ellipsoid", varargin{:});
 
   if (nargin != 6 && nargin != 7)
     print_usage ();
@@ -64,7 +63,17 @@
     yy = y;
     zz = z;
   else
-    surf (h, x, y, z);
+    oldfig = ifelse (isempty (hax), [], get (0, "currentfigure"));
+    unwind_protect
+      hax = newplot (hax);
+    
+      surf (hax, x, y, z);
+      
+    unwind_protect_cleanup
+      if (! isempty (oldfig))
+        set (0, "currentfigure", oldfig);
+      endif
+    end_unwind_protect
   endif
 
 endfunction