Mercurial > hg > octave-lyh
diff scripts/plot/surf.m @ 17052:1118d566bcd4
surf.m, surfc.m, surfl.m, surfnorm.m: Update to use new __plt_get_axis_arg__.
* scripts/plot/surf.m, scripts/plot/surfl.m, scripts/plot/surfnorm.m:
Update to use new __plt_get_axis_arg__. Rename h to hax. Rename tmp to htmp.
* scripts/plot/surfc.m: Check __plt_get_axis_arg__ before calling newplot.
Remove obsolete code checking for input axis handle. Use cellfun to eliminate
for loop.
author | Pantxo Diribarne <pantxo.diribarne@gmail.com> |
---|---|
date | Tue, 23 Jul 2013 16:26:43 +0200 |
parents | c4fa5e0b6193 |
children | a639221f9863 |
line wrap: on
line diff
--- a/scripts/plot/surf.m +++ b/scripts/plot/surf.m @@ -42,24 +42,26 @@ function retval = surf (varargin) - [h, varargin] = __plt_get_axis_arg__ ("surf", varargin{:}); + [hax, varargin] = __plt_get_axis_arg__ ("surf", varargin{:}); - oldh = gca (); + oldfig = ifelse (isempty (hax), [], get (0, "currentfigure")); unwind_protect - axes (h); - newplot (); - tmp = surface (varargin{:}); + hax = newplot (hax); + + htmp = surface (varargin{:}); - if (! ishold ()) - set (h, "view", [-37.5, 30], + if (! ishold (hax)) + set (hax, "view", [-37.5, 30], "xgrid", "on", "ygrid", "on", "zgrid", "on"); endif unwind_protect_cleanup - axes (oldh); + if (! isempty (oldfig)) + set (0, "currentfigure", oldfig); + endif end_unwind_protect if (nargout > 0) - retval = tmp; + retval = htmp; endif endfunction