diff scripts/plot/contourf.m @ 17050:9ff7d4849f03

contour[3f].m: Update to use new __plt_get_axis_arg__. * scripts/plot/contourf.m, scripts/plot/contour3.m, scripts/plot/contour.m: Update to use new __plt_get_axis_arg__. Rename xh to hax.
author Pantxo Diribarne <pantxo.diribarne@gmail.com>
date Tue, 23 Jul 2013 14:45:31 +0200
parents 64e7bb01fce2
children eaab03308c0b
line wrap: on
line diff
--- a/scripts/plot/contourf.m
+++ b/scripts/plot/contourf.m
@@ -66,16 +66,19 @@
 
 function [c, h] = contourf (varargin)
 
-  [xh, varargin] = __plt_get_axis_arg__ ("contour", varargin{:});
+  [hax, varargin] = __plt_get_axis_arg__ ("contour", varargin{:});
 
-  oldh = gca ();
+  oldfig = ifelse (isempty (hax), [], get (0, "currentfigure"));
   unwind_protect
-    axes (xh);
-    newplot ();
-    [ctmp, htmp] = __contour__ (xh, "none", "fill", "on",
+    hax = newplot (hax);
+    
+    [ctmp, htmp] = __contour__ (hax, "none", "fill", "on",
                                 "linecolor", "black", varargin{:});
+    
   unwind_protect_cleanup
-    axes (oldh);
+    if (! isempty (oldfig))
+      set (0, "currentfigure", oldfig);
+    endif
   end_unwind_protect
 
   if (nargout > 0)