Mercurial > hg > octave-nkf
diff scripts/plot/comet3.m @ 17060:2d17dbdf6b7d
comet.m, comet3.m: Update to use new __plt_get_axis_arg__.
* scripts/plot/comet.m, scripts/plot/comet3.m: Update to use new
__plt_get_axis_arg__.
author | Rik <rik@octave.org> |
---|---|
date | Wed, 24 Jul 2013 23:12:46 -0700 |
parents | a4969508008e |
children | eaab03308c0b |
line wrap: on
line diff
--- a/scripts/plot/comet3.m +++ b/scripts/plot/comet3.m @@ -39,7 +39,7 @@ function comet3 (varargin) - [h, varargin, nargin] = __plt_get_axis_arg__ ("comet3", varargin{:}); + [hax, varargin, nargin] = __plt_get_axis_arg__ ("comet3", varargin{:}); if (nargin == 0 || nargin == 2 || nargin > 4) print_usage (); @@ -59,25 +59,27 @@ p = varargin{4}; endif - oldh = gca (); + oldfig = ifelse (isempty (hax), [], get (0, "currentfigure")); unwind_protect - axes (h); - newplot (); - theaxis = [min(x), max(x), min(y), max(y), min(z), max(z)]; + hax = newplot (hax); + limits = [min(x), max(x), min(y), max(y), min(z), max(z)]; num = numel (y); dn = round (num/10); for n = 1:(num+dn); m = n - dn; m = max ([m, 1]); k = min ([n, num]); - h = plot3 (x(1:m), y(1:m), z(1:m), "r", x(m:k), y(m:k), z(m:k), "g", - x(k), y(k), z(k), "ob"); - axis (theaxis); + htmp = plot3 (hax, x(1:m), y(1:m), z(1:m), "r", + x(m:k), y(m:k), z(m:k), "g", + x(k), y(k), z(k), "ob"); + axis (limits); drawnow (); pause (p); endfor unwind_protect_cleanup - axes (oldh); + if (! isempty (oldfig)) + set (0, "currentfigure", oldfig); + endif end_unwind_protect endfunction