diff scripts/plot/quiver.m @ 17070:d465f9970c02

quiver.m, quiver3.m: Upgrade to use new __plt_get_axis_arg__. * scripts/plot/quiver.m, scripts/plot/quiver3.m: Upgrade to use new __plt_get_axis_arg__.
author Pantxo Diribarne <pantxo.diribarne@gmail.com>
date Tue, 23 Jul 2013 18:44:37 +0200
parents 64e7bb01fce2
children eaab03308c0b
line wrap: on
line diff
--- a/scripts/plot/quiver.m
+++ b/scripts/plot/quiver.m
@@ -60,23 +60,24 @@
 
 function retval = quiver (varargin)
 
-  [h, varargin, nargin] = __plt_get_axis_arg__ ("quiver", varargin{:});
+  [hax, varargin, nargin] = __plt_get_axis_arg__ ("quiver", varargin{:});
 
   if (nargin < 2)
     print_usage ();
   else
-    oldh = gca ();
+    oldfig = ifelse (isempty (hax), [], get (0, "currentfigure"));
     unwind_protect
-      axes (h);
-      newplot ();
-      tmp = __quiver__ (h, 0, varargin{:});
+      hax = newplot (hax);
+      htmp = __quiver__ (hax, false, varargin{:});
     unwind_protect_cleanup
-      axes (oldh);
+    if (! isempty (oldfig))
+      set (0, "currentfigure", oldfig);
+    endif
     end_unwind_protect
   endif
 
   if (nargout > 0)
-    retval = tmp;
+    retval = htmp;
   endif
 
 endfunction