Mercurial > octave
annotate scripts/plot/draw/quiver3.m @ 24431:0c6cedafc71e stable
doc: Use 'axes' rather than 'axis' appropriately in docstrings.
* voronoi.m, axis.m, box.m, caxis.m, datetick.m, grid.m, legend.m,
lighting.m, shading.m, title.m, view.m, xlabel.m, xlim.m, ylabel.m, ylim.m,
zlabel.m, zlim.m, area.m, bar.m, barh.m, colorbar.m, comet.m, comet3.m,
compass.m, contour.m, contour3.m, contourf.m, cylinder.m, ellipsoid.m,
errorbar.m, ezcontour.m, ezcontourf.m, ezmesh.m, ezmeshc.m, ezplot.m,
ezplot3.m, ezpolar.m, ezsurf.m, ezsurfc.m, feather.m, fill.m, fplot.m, hist.m,
line.m, loglog.m, loglogerr.m, mesh.m, meshc.m, meshz.m, pareto.m, patch.m,
pcolor.m, pie.m, pie3.m, plot.m, plot3.m, plotmatrix.m, plotyy.m, polar.m,
quiver.m, quiver3.m, rectangle.m, ribbon.m, rose.m, scatter.m, scatter3.m,
semilogx.m, semilogxerr.m, semilogy.m, semilogyerr.m, slice.m, sphere.m,
stairs.m, stem.m, stem3.m, surf.m, surface.m, surfc.m, surfl.m, surfnorm.m,
waterfall.m, axes.m, cla.m, gca.m, hold.m, newplot.m, subplot.m:
Use 'axes' rather than 'axis' appropriately in docstrings.
author | Rik <rik@octave.org> |
---|---|
date | Tue, 19 Dec 2017 12:39:25 -0800 |
parents | 6915cc404dba |
children | 6cf385e26616 |
rev | line source |
---|---|
23219
3ac9f9ecfae5
maint: Update copyright dates.
John W. Eaton <jwe@octave.org>
parents:
23083
diff
changeset
|
1 ## Copyright (C) 2007-2017 David Bateman |
7189 | 2 ## |
3 ## This file is part of Octave. | |
4 ## | |
5 ## Octave is free software; you can redistribute it and/or modify it | |
6 ## under the terms of the GNU General Public License as published by | |
7 ## the Free Software Foundation; either version 3 of the License, or (at | |
8 ## your option) any later version. | |
9 ## | |
10 ## Octave is distributed in the hope that it will be useful, but | |
11 ## WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
13 ## General Public License for more details. | |
14 ## | |
15 ## You should have received a copy of the GNU General Public License | |
16 ## along with Octave; see the file COPYING. If not, see | |
17 ## <http://www.gnu.org/licenses/>. | |
18 | |
19 ## -*- texinfo -*- | |
20852
516bb87ea72e
2015 Code Sprint: remove class of function from docstring for all m-files.
Rik <rik@octave.org>
parents:
20181
diff
changeset
|
20 ## @deftypefn {} {} quiver3 (@var{u}, @var{v}, @var{w}) |
516bb87ea72e
2015 Code Sprint: remove class of function from docstring for all m-files.
Rik <rik@octave.org>
parents:
20181
diff
changeset
|
21 ## @deftypefnx {} {} quiver3 (@var{x}, @var{y}, @var{z}, @var{u}, @var{v}, @var{w}) |
516bb87ea72e
2015 Code Sprint: remove class of function from docstring for all m-files.
Rik <rik@octave.org>
parents:
20181
diff
changeset
|
22 ## @deftypefnx {} {} quiver3 (@dots{}, @var{s}) |
516bb87ea72e
2015 Code Sprint: remove class of function from docstring for all m-files.
Rik <rik@octave.org>
parents:
20181
diff
changeset
|
23 ## @deftypefnx {} {} quiver3 (@dots{}, @var{style}) |
516bb87ea72e
2015 Code Sprint: remove class of function from docstring for all m-files.
Rik <rik@octave.org>
parents:
20181
diff
changeset
|
24 ## @deftypefnx {} {} quiver3 (@dots{}, "filled") |
516bb87ea72e
2015 Code Sprint: remove class of function from docstring for all m-files.
Rik <rik@octave.org>
parents:
20181
diff
changeset
|
25 ## @deftypefnx {} {} quiver3 (@var{hax}, @dots{}) |
516bb87ea72e
2015 Code Sprint: remove class of function from docstring for all m-files.
Rik <rik@octave.org>
parents:
20181
diff
changeset
|
26 ## @deftypefnx {} {@var{h} =} quiver3 (@dots{}) |
7189 | 27 ## |
20173
777f26aa8e3e
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
28 ## Plot a 3-D vector field with arrows. |
20181
aa36fb998a4d
maint: Remove unnecessary whitespace at end of lines.
Rik <rik@octave.org>
parents:
20173
diff
changeset
|
29 ## |
24381
6915cc404dba
doc: Clarify quiver/quiver3 documentation when a linestyle is given (bug #52608).
Rik <rik@octave.org>
parents:
23219
diff
changeset
|
30 ## Plot the (@var{u}, @var{v}, @var{w}) components of a vector field at the |
6915cc404dba
doc: Clarify quiver/quiver3 documentation when a linestyle is given (bug #52608).
Rik <rik@octave.org>
parents:
23219
diff
changeset
|
31 ## grid points defined by (@var{x}, @var{y}, @var{z}). If the grid is uniform |
6915cc404dba
doc: Clarify quiver/quiver3 documentation when a linestyle is given (bug #52608).
Rik <rik@octave.org>
parents:
23219
diff
changeset
|
32 ## then @var{x}, @var{y}, and @var{z} can be specified as vectors and |
6915cc404dba
doc: Clarify quiver/quiver3 documentation when a linestyle is given (bug #52608).
Rik <rik@octave.org>
parents:
23219
diff
changeset
|
33 ## @code{meshgrid} is used to create the 3-D grid. |
7189 | 34 ## |
24381
6915cc404dba
doc: Clarify quiver/quiver3 documentation when a linestyle is given (bug #52608).
Rik <rik@octave.org>
parents:
23219
diff
changeset
|
35 ## If @var{x}, @var{y}, and @var{z} are not given they are assumed to be |
6915cc404dba
doc: Clarify quiver/quiver3 documentation when a linestyle is given (bug #52608).
Rik <rik@octave.org>
parents:
23219
diff
changeset
|
36 ## @code{(1:@var{m}, 1:@var{n}, 1:@var{p})} where |
6915cc404dba
doc: Clarify quiver/quiver3 documentation when a linestyle is given (bug #52608).
Rik <rik@octave.org>
parents:
23219
diff
changeset
|
37 ## @code{[@var{m}, @var{n}] = size (@var{u})} and |
6915cc404dba
doc: Clarify quiver/quiver3 documentation when a linestyle is given (bug #52608).
Rik <rik@octave.org>
parents:
23219
diff
changeset
|
38 ## @code{@var{p} = max (size (@var{w}))}. |
7189 | 39 ## |
24381
6915cc404dba
doc: Clarify quiver/quiver3 documentation when a linestyle is given (bug #52608).
Rik <rik@octave.org>
parents:
23219
diff
changeset
|
40 ## The optional input @var{s} is a scalar defining a scaling factor to use for |
6915cc404dba
doc: Clarify quiver/quiver3 documentation when a linestyle is given (bug #52608).
Rik <rik@octave.org>
parents:
23219
diff
changeset
|
41 ## the arrows of the field relative to the mesh spacing. A value of 1.0 will |
6915cc404dba
doc: Clarify quiver/quiver3 documentation when a linestyle is given (bug #52608).
Rik <rik@octave.org>
parents:
23219
diff
changeset
|
42 ## result in the longest vector exactly filling one grid cube. A value of 0 |
17671 | 43 ## disables all scaling. The default value is 0.9. |
7189 | 44 ## |
45 ## The style to use for the plot can be defined with a line style @var{style} | |
24381
6915cc404dba
doc: Clarify quiver/quiver3 documentation when a linestyle is given (bug #52608).
Rik <rik@octave.org>
parents:
23219
diff
changeset
|
46 ## of the same format as the @code{plot} command. If a marker is specified |
6915cc404dba
doc: Clarify quiver/quiver3 documentation when a linestyle is given (bug #52608).
Rik <rik@octave.org>
parents:
23219
diff
changeset
|
47 ## then the markers are drawn at the origin of the vectors (which are the grid |
6915cc404dba
doc: Clarify quiver/quiver3 documentation when a linestyle is given (bug #52608).
Rik <rik@octave.org>
parents:
23219
diff
changeset
|
48 ## points defined by @var{x}, @var{y}, @var{z}). When a marker is specified, |
6915cc404dba
doc: Clarify quiver/quiver3 documentation when a linestyle is given (bug #52608).
Rik <rik@octave.org>
parents:
23219
diff
changeset
|
49 ## the arrowhead is not drawn. If the argument @qcode{"filled"} is given then |
21546
f7f97d7e9294
doc: Wrap m-file docstrings to 79 characters + newline (80 total).
Rik <rik@octave.org>
parents:
20852
diff
changeset
|
50 ## the markers are filled. |
7189 | 51 ## |
24431
0c6cedafc71e
doc: Use 'axes' rather than 'axis' appropriately in docstrings.
Rik <rik@octave.org>
parents:
24381
diff
changeset
|
52 ## If the first argument @var{hax} is an axes handle, then plot into this axes, |
17161
52931d71400f
doc: Document that first argument can be an axes handle for several plot functions.
Rik <rik@octave.org>
parents:
17122
diff
changeset
|
53 ## rather than the current axes returned by @code{gca}. |
52931d71400f
doc: Document that first argument can be an axes handle for several plot functions.
Rik <rik@octave.org>
parents:
17122
diff
changeset
|
54 ## |
14001
5f0bb45e615c
doc: Update documentation for functions returning a graphics handle h (Bug #34761)
Rik <octave@nomad.inbox5.com>
parents:
11587
diff
changeset
|
55 ## The optional return value @var{h} is a graphics handle to a quiver object. |
5f0bb45e615c
doc: Update documentation for functions returning a graphics handle h (Bug #34761)
Rik <octave@nomad.inbox5.com>
parents:
11587
diff
changeset
|
56 ## A quiver object regroups the components of the quiver plot (body, arrow, |
5f0bb45e615c
doc: Update documentation for functions returning a graphics handle h (Bug #34761)
Rik <octave@nomad.inbox5.com>
parents:
11587
diff
changeset
|
57 ## and marker), and allows them to be changed together. |
7189 | 58 ## |
59 ## @example | |
60 ## @group | |
61 ## [x, y, z] = peaks (25); | |
62 ## surf (x, y, z); | |
63 ## hold on; | |
64 ## [u, v, w] = surfnorm (x, y, z / 10); | |
8056
9a6f4713f765
Add area, bar, quiver and stair series graphics objects. Document them
David Bateman <dbateman@free.fr>
parents:
7245
diff
changeset
|
65 ## h = quiver3 (x, y, z, u, v, w); |
9a6f4713f765
Add area, bar, quiver and stair series graphics objects. Document them
David Bateman <dbateman@free.fr>
parents:
7245
diff
changeset
|
66 ## set (h, "maxheadsize", 0.33); |
7189 | 67 ## @end group |
68 ## @end example | |
69 ## | |
17122
eaab03308c0b
doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents:
17070
diff
changeset
|
70 ## @seealso{quiver, compass, feather, plot} |
7189 | 71 ## @end deftypefn |
72 | |
17671 | 73 function h = quiver3 (varargin) |
7189 | 74 |
17070
d465f9970c02
quiver.m, quiver3.m: Upgrade to use new __plt_get_axis_arg__.
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
16814
diff
changeset
|
75 [hax, varargin, nargin] = __plt_get_axis_arg__ ("quiver3", varargin{:}); |
7215 | 76 |
7189 | 77 if (nargin < 2) |
78 print_usage (); | |
17671 | 79 endif |
80 | |
17211
87ba70043bfc
Don't use ifelse in plot fcns to avoid unnecessary fcn evaluations.
Rik <rik@octave.org>
parents:
17161
diff
changeset
|
81 oldfig = []; |
17301
68bcac3c043a
Correct inversion accidentally introduced in cset 87ba70043bfc.
Rik <rik@octave.org>
parents:
17281
diff
changeset
|
82 if (! isempty (hax)) |
17211
87ba70043bfc
Don't use ifelse in plot fcns to avoid unnecessary fcn evaluations.
Rik <rik@octave.org>
parents:
17161
diff
changeset
|
83 oldfig = get (0, "currentfigure"); |
87ba70043bfc
Don't use ifelse in plot fcns to avoid unnecessary fcn evaluations.
Rik <rik@octave.org>
parents:
17161
diff
changeset
|
84 endif |
17671 | 85 unwind_protect |
86 hax = newplot (hax); | |
87 htmp = __quiver__ (hax, true, varargin{:}); | |
17070
d465f9970c02
quiver.m, quiver3.m: Upgrade to use new __plt_get_axis_arg__.
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
16814
diff
changeset
|
88 |
22367
459545bc9019
Use ishold () rather than ishold (hax) for performance.
Rik <rik@octave.org>
parents:
22351
diff
changeset
|
89 if (! ishold ()) |
22351
e6df1ddfc3cf
Change DefaultAxesBox property to "off".
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
90 set (hax, "view", [-37.5, 30], |
17671 | 91 "xgrid", "on", "ygrid", "on", "zgrid", "on"); |
92 endif | |
93 unwind_protect_cleanup | |
94 if (! isempty (oldfig)) | |
95 set (0, "currentfigure", oldfig); | |
96 endif | |
97 end_unwind_protect | |
7189 | 98 |
99 if (nargout > 0) | |
17671 | 100 h = htmp; |
7189 | 101 endif |
102 | |
103 endfunction | |
104 | |
14237
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
105 |
7189 | 106 %!demo |
14237
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
107 %! clf; |
22302
1c4cd12987f5
Use Octave syntax in graphics demos.
Rik <rik@octave.org>
parents:
21546
diff
changeset
|
108 %! colormap ("default"); |
7245 | 109 %! [x, y, z] = peaks (25); |
110 %! surf (x, y, z); | |
111 %! hold on; | |
112 %! [u, v, w] = surfnorm (x, y, z / 10); | |
8056
9a6f4713f765
Add area, bar, quiver and stair series graphics objects. Document them
David Bateman <dbateman@free.fr>
parents:
7245
diff
changeset
|
113 %! h = quiver3 (x, y, z, u, v, w); |
22302
1c4cd12987f5
Use Octave syntax in graphics demos.
Rik <rik@octave.org>
parents:
21546
diff
changeset
|
114 %! set (h, "maxheadsize", 0.25); |
8253
873ea2c72f16
quiver3.m: turn hold off after demo
John W. Eaton <jwe@octave.org>
parents:
8056
diff
changeset
|
115 %! hold off; |
24381
6915cc404dba
doc: Clarify quiver/quiver3 documentation when a linestyle is given (bug #52608).
Rik <rik@octave.org>
parents:
23219
diff
changeset
|
116 %! title ("quiver3() of surface normals to peaks() function"); |
8889
665b264b6a50
Compatible support of figure paper properties and resolution for the gnuplot backend.
Ben Abbott <bpabbott@mac.com>
parents:
8253
diff
changeset
|
117 |
665b264b6a50
Compatible support of figure paper properties and resolution for the gnuplot backend.
Ben Abbott <bpabbott@mac.com>
parents:
8253
diff
changeset
|
118 %!demo |
14237
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
119 %! clf; |
22302
1c4cd12987f5
Use Octave syntax in graphics demos.
Rik <rik@octave.org>
parents:
21546
diff
changeset
|
120 %! colormap ("default"); |
14092
22c50cbad2ce
Add clf() to all plot demos.
Ben Abbott <bpabbott@mac.com>
parents:
14001
diff
changeset
|
121 %! [x, y, z] = peaks (25); |
22c50cbad2ce
Add clf() to all plot demos.
Ben Abbott <bpabbott@mac.com>
parents:
14001
diff
changeset
|
122 %! surf (x, y, z); |
22c50cbad2ce
Add clf() to all plot demos.
Ben Abbott <bpabbott@mac.com>
parents:
14001
diff
changeset
|
123 %! hold on; |
22c50cbad2ce
Add clf() to all plot demos.
Ben Abbott <bpabbott@mac.com>
parents:
14001
diff
changeset
|
124 %! [u, v, w] = surfnorm (x, y, z / 10); |
22c50cbad2ce
Add clf() to all plot demos.
Ben Abbott <bpabbott@mac.com>
parents:
14001
diff
changeset
|
125 %! h = quiver3 (x, y, z, u, v, w); |
22302
1c4cd12987f5
Use Octave syntax in graphics demos.
Rik <rik@octave.org>
parents:
21546
diff
changeset
|
126 %! set (h, "maxheadsize", 0.25); |
14092
22c50cbad2ce
Add clf() to all plot demos.
Ben Abbott <bpabbott@mac.com>
parents:
14001
diff
changeset
|
127 %! hold off; |
14237
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
128 %! shading interp; |
24381
6915cc404dba
doc: Clarify quiver/quiver3 documentation when a linestyle is given (bug #52608).
Rik <rik@octave.org>
parents:
23219
diff
changeset
|
129 %! title ({"quiver3() of surface normals to peaks() function"; ... |
17671 | 130 %! 'shading "interp"'}); |