Mercurial > hg > octave-lyh
diff scripts/plot/quiver3.m @ 17070:d465f9970c02
quiver.m, quiver3.m: Upgrade to use new __plt_get_axis_arg__.
* scripts/plot/quiver.m, scripts/plot/quiver3.m: Upgrade to use new
__plt_get_axis_arg__.
author | Pantxo Diribarne <pantxo.diribarne@gmail.com> |
---|---|
date | Tue, 23 Jul 2013 18:44:37 +0200 |
parents | 64e7bb01fce2 |
children | eaab03308c0b |
line wrap: on
line diff
--- a/scripts/plot/quiver3.m +++ b/scripts/plot/quiver3.m @@ -63,23 +63,28 @@ function retval = quiver3 (varargin) - [h, varargin, nargin] = __plt_get_axis_arg__ ("quiver3", varargin{:}); + [hax, varargin, nargin] = __plt_get_axis_arg__ ("quiver3", varargin{:}); if (nargin < 2) print_usage (); else - oldh = gca (); + oldfig = ifelse (isempty (hax), [], get (0, "currentfigure")); unwind_protect - axes (h); - newplot (); - tmp = __quiver__ (h, 1, varargin{:}); + hax = newplot (hax); + htmp = __quiver__ (hax, true, varargin{:}); + + if (! ishold (hax)) + set (hax, "view", [-37.5, 30]); # 3D view + endif unwind_protect_cleanup - axes (oldh); + if (! isempty (oldfig)) + set (0, "currentfigure", oldfig); + endif end_unwind_protect endif if (nargout > 0) - retval = tmp; + retval = htmp; endif endfunction @@ -91,9 +96,9 @@ %! [x,y] = meshgrid (-1:0.1:1); %! z = sin (2*pi * sqrt (x.^2 + y.^2)); %! theta = 2*pi * sqrt (x.^2 + y.^2) + pi/2; -%! quiver3 (x, y, z, sin (theta), cos (theta), ones (size (z))); +%! mesh (x, y, z); %! hold on; -%! mesh (x, y, z); +%! quiver3 (x, y, z, sin (theta), cos (theta), ones (size (z))); %! hold off; %!demo