Mercurial > hg > octave-nkf
diff scripts/plot/comet.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 | 64e7bb01fce2 |
children | eaab03308c0b |
line wrap: on
line diff
--- a/scripts/plot/comet.m +++ b/scripts/plot/comet.m @@ -39,7 +39,7 @@ function comet (varargin) - [h, varargin, nargin] = __plt_get_axis_arg__ ("comet", varargin{:}); + [hax, varargin, nargin] = __plt_get_axis_arg__ ("comet", varargin{:}); if (nargin == 0) print_usage (); @@ -57,24 +57,25 @@ p = varargin{3}; endif - oldh = gca (); + oldfig = ifelse (isempty (hax), [], get (0, "currentfigure")); unwind_protect - axes (h); - newplot (); - theaxis = [min(x), max(x), min(y), max(y)]; + hax = newplot (hax); + limits = [min(x), max(x), min(y), max(y)]; num = numel (y); dn = round (num/10); for n = 1:(num+dn); m = n - dn; m = max ([m, 1]); k = min ([n, num]); - h = plot (x(1:m), y(1:m), "r", x(m:k), y(m:k), "g", x(k), y(k), "ob"); - axis (theaxis); + plot (hax, x(1:m), y(1:m), "r", x(m:k), y(m:k), "g", x(k), y(k), "ob"); + axis (hax, limits); drawnow (); pause (p); endfor unwind_protect_cleanup - axes (oldh); + if (! isempty (oldfig)) + set (0, "currentfigure", oldfig); + endif end_unwind_protect endfunction