Mercurial > hg > octave-lyh
comparison scripts/plot/sphere.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 | 72c96de7a403 |
children | eaab03308c0b |
comparison
equal
deleted
inserted
replaced
17050:9ff7d4849f03 | 17051:3e1b24a2454a |
---|---|
30 ## @seealso{peaks} | 30 ## @seealso{peaks} |
31 ## @end deftypefn | 31 ## @end deftypefn |
32 | 32 |
33 function [xx, yy, zz] = sphere (varargin) | 33 function [xx, yy, zz] = sphere (varargin) |
34 | 34 |
35 [h, varargin, nargin] = __plt_get_axis_arg__ ((nargout > 0), "sphere", | 35 [hax, varargin, nargin] = __plt_get_axis_arg__ ("sphere", varargin{:}); |
36 varargin{:}); | 36 |
37 if (nargin > 1) | 37 if (nargin > 1) |
38 print_usage (); | 38 print_usage (); |
39 elseif (nargin == 1) | 39 elseif (nargin == 1) |
40 n = varargin{1}; | 40 n = varargin{1}; |
41 else | 41 else |
53 if (nargout > 0) | 53 if (nargout > 0) |
54 xx = x; | 54 xx = x; |
55 yy = y; | 55 yy = y; |
56 zz = z; | 56 zz = z; |
57 else | 57 else |
58 surf (h, x, y, z); | 58 oldfig = ifelse (isempty (hax), [], get (0, "currentfigure")); |
59 unwind_protect | |
60 hax = newplot (hax); | |
61 | |
62 surf (hax, x, y, z); | |
63 | |
64 unwind_protect_cleanup | |
65 if (! isempty (oldfig)) | |
66 set (0, "currentfigure", oldfig); | |
67 endif | |
68 end_unwind_protect | |
59 endif | 69 endif |
60 | 70 |
61 endfunction | 71 endfunction |