annotate scripts/plot/draw/slice.m @ 21530:7c143e73e921

doc: Don't create end-of-sentence period with "etc." in Texinfo. * external.txi, genpropdoc.m, oop.txi, strread.m, slice.m: Use "@:" following "etc." to create a period which does not end the sentence.
author Rik <rik@octave.org>
date Thu, 24 Mar 2016 15:45:11 -0700
parents 516bb87ea72e
children 1c4cd12987f5
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
19697
4197fc428c7d maint: Update copyright notices for 2015.
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
1 ## Copyright (C) 2007-2015 Kai Habel, David Bateman
7183
c0be321eb472 [project @ 2007-11-26 18:31:53 by jwe]
jwe
parents:
diff changeset
2 ##
c0be321eb472 [project @ 2007-11-26 18:31:53 by jwe]
jwe
parents:
diff changeset
3 ## This file is part of Octave.
c0be321eb472 [project @ 2007-11-26 18:31:53 by jwe]
jwe
parents:
diff changeset
4 ##
c0be321eb472 [project @ 2007-11-26 18:31:53 by jwe]
jwe
parents:
diff changeset
5 ## Octave is free software; you can redistribute it and/or modify it
c0be321eb472 [project @ 2007-11-26 18:31:53 by jwe]
jwe
parents:
diff changeset
6 ## under the terms of the GNU General Public License as published by
c0be321eb472 [project @ 2007-11-26 18:31:53 by jwe]
jwe
parents:
diff changeset
7 ## the Free Software Foundation; either version 3 of the License, or (at
c0be321eb472 [project @ 2007-11-26 18:31:53 by jwe]
jwe
parents:
diff changeset
8 ## your option) any later version.
c0be321eb472 [project @ 2007-11-26 18:31:53 by jwe]
jwe
parents:
diff changeset
9 ##
c0be321eb472 [project @ 2007-11-26 18:31:53 by jwe]
jwe
parents:
diff changeset
10 ## Octave is distributed in the hope that it will be useful, but
c0be321eb472 [project @ 2007-11-26 18:31:53 by jwe]
jwe
parents:
diff changeset
11 ## WITHOUT ANY WARRANTY; without even the implied warranty of
c0be321eb472 [project @ 2007-11-26 18:31:53 by jwe]
jwe
parents:
diff changeset
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
c0be321eb472 [project @ 2007-11-26 18:31:53 by jwe]
jwe
parents:
diff changeset
13 ## General Public License for more details.
c0be321eb472 [project @ 2007-11-26 18:31:53 by jwe]
jwe
parents:
diff changeset
14 ##
c0be321eb472 [project @ 2007-11-26 18:31:53 by jwe]
jwe
parents:
diff changeset
15 ## You should have received a copy of the GNU General Public License
c0be321eb472 [project @ 2007-11-26 18:31:53 by jwe]
jwe
parents:
diff changeset
16 ## along with Octave; see the file COPYING. If not, see
c0be321eb472 [project @ 2007-11-26 18:31:53 by jwe]
jwe
parents:
diff changeset
17 ## <http://www.gnu.org/licenses/>.
c0be321eb472 [project @ 2007-11-26 18:31:53 by jwe]
jwe
parents:
diff changeset
18
c0be321eb472 [project @ 2007-11-26 18:31:53 by jwe]
jwe
parents:
diff changeset
19 ## -*- texinfo -*-
20852
516bb87ea72e 2015 Code Sprint: remove class of function from docstring for all m-files.
Rik <rik@octave.org>
parents: 19833
diff changeset
20 ## @deftypefn {} {} slice (@var{x}, @var{y}, @var{z}, @var{v}, @var{sx}, @var{sy}, @var{sz})
516bb87ea72e 2015 Code Sprint: remove class of function from docstring for all m-files.
Rik <rik@octave.org>
parents: 19833
diff changeset
21 ## @deftypefnx {} {} slice (@var{x}, @var{y}, @var{z}, @var{v}, @var{xi}, @var{yi}, @var{zi})
516bb87ea72e 2015 Code Sprint: remove class of function from docstring for all m-files.
Rik <rik@octave.org>
parents: 19833
diff changeset
22 ## @deftypefnx {} {} slice (@var{v}, @var{sx}, @var{sy}, @var{sz})
516bb87ea72e 2015 Code Sprint: remove class of function from docstring for all m-files.
Rik <rik@octave.org>
parents: 19833
diff changeset
23 ## @deftypefnx {} {} slice (@var{v}, @var{xi}, @var{yi}, @var{zi})
516bb87ea72e 2015 Code Sprint: remove class of function from docstring for all m-files.
Rik <rik@octave.org>
parents: 19833
diff changeset
24 ## @deftypefnx {} {} slice (@dots{}, @var{method})
516bb87ea72e 2015 Code Sprint: remove class of function from docstring for all m-files.
Rik <rik@octave.org>
parents: 19833
diff changeset
25 ## @deftypefnx {} {} slice (@var{hax}, @dots{})
516bb87ea72e 2015 Code Sprint: remove class of function from docstring for all m-files.
Rik <rik@octave.org>
parents: 19833
diff changeset
26 ## @deftypefnx {} {@var{h} =} slice (@dots{})
17077
f8b485d09ac6 ribbon.m, slice.m: Overhaul to use __plt_get_axis_arg__.
Rik <rik@octave.org>
parents: 15009
diff changeset
27 ## Plot slices of 3-D data/scalar fields.
f8b485d09ac6 ribbon.m, slice.m: Overhaul to use __plt_get_axis_arg__.
Rik <rik@octave.org>
parents: 15009
diff changeset
28 ##
17122
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 17077
diff changeset
29 ## Each element of the 3-dimensional array @var{v} represents a scalar value at
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 17077
diff changeset
30 ## a location given by the parameters @var{x}, @var{y}, and @var{z}. The
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 17077
diff changeset
31 ## parameters @var{x}, @var{x}, and @var{z} are either 3-dimensional arrays of
17281
bc924baa2c4e doc: Add new @qcode macro for code samples which are quoted.
Rik <rik@octave.org>
parents: 17211
diff changeset
32 ## the same size as the array @var{v} in the @qcode{"meshgrid"} format or
21530
7c143e73e921 doc: Don't create end-of-sentence period with "etc." in Texinfo.
Rik <rik@octave.org>
parents: 20852
diff changeset
33 ## vectors. The parameters @var{xi}, etc.@: respect a similar format to
17281
bc924baa2c4e doc: Add new @qcode macro for code samples which are quoted.
Rik <rik@octave.org>
parents: 17211
diff changeset
34 ## @var{x}, etc., and they represent the points at which the array @var{vi}
bc924baa2c4e doc: Add new @qcode macro for code samples which are quoted.
Rik <rik@octave.org>
parents: 17211
diff changeset
35 ## is interpolated using interp3. The vectors @var{sx}, @var{sy}, and
bc924baa2c4e doc: Add new @qcode macro for code samples which are quoted.
Rik <rik@octave.org>
parents: 17211
diff changeset
36 ## @var{sz} contain points of orthogonal slices of the respective axes.
7183
c0be321eb472 [project @ 2007-11-26 18:31:53 by jwe]
jwe
parents:
diff changeset
37 ##
11587
c792872f8942 all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents: 11563
diff changeset
38 ## If @var{x}, @var{y}, @var{z} are omitted, they are assumed to be
7184
2f915d6cac3d [project @ 2007-11-26 18:45:02 by jwe]
jwe
parents: 7183
diff changeset
39 ## @code{x = 1:size (@var{v}, 2)}, @code{y = 1:size (@var{v}, 1)} and
11587
c792872f8942 all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents: 11563
diff changeset
40 ## @code{z = 1:size (@var{v}, 3)}.
7183
c0be321eb472 [project @ 2007-11-26 18:31:53 by jwe]
jwe
parents:
diff changeset
41 ##
17077
f8b485d09ac6 ribbon.m, slice.m: Overhaul to use __plt_get_axis_arg__.
Rik <rik@octave.org>
parents: 15009
diff changeset
42 ## @var{method} is one of:
7183
c0be321eb472 [project @ 2007-11-26 18:31:53 by jwe]
jwe
parents:
diff changeset
43 ##
11595
5ec6aa05638d Prevent doubled quotes around @table items in Info.
Rik <octave@nomad.inbox5.com>
parents: 11587
diff changeset
44 ## @table @asis
17281
bc924baa2c4e doc: Add new @qcode macro for code samples which are quoted.
Rik <rik@octave.org>
parents: 17211
diff changeset
45 ## @item @qcode{"nearest"}
9040
dbd0c77e575e Cleanup documentation file plot.texi
Rik <rdrider0-list@yahoo.com>
parents: 8920
diff changeset
46 ## Return the nearest neighbor.
10821
693e22af08ae Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents: 10793
diff changeset
47 ##
17281
bc924baa2c4e doc: Add new @qcode macro for code samples which are quoted.
Rik <rik@octave.org>
parents: 17211
diff changeset
48 ## @item @qcode{"linear"}
9040
dbd0c77e575e Cleanup documentation file plot.texi
Rik <rdrider0-list@yahoo.com>
parents: 8920
diff changeset
49 ## Linear interpolation from nearest neighbors.
10821
693e22af08ae Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents: 10793
diff changeset
50 ##
17281
bc924baa2c4e doc: Add new @qcode macro for code samples which are quoted.
Rik <rik@octave.org>
parents: 17211
diff changeset
51 ## @item @qcode{"cubic"}
9040
dbd0c77e575e Cleanup documentation file plot.texi
Rik <rdrider0-list@yahoo.com>
parents: 8920
diff changeset
52 ## Cubic interpolation from four nearest neighbors (not implemented yet).
10821
693e22af08ae Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents: 10793
diff changeset
53 ##
17281
bc924baa2c4e doc: Add new @qcode macro for code samples which are quoted.
Rik <rik@octave.org>
parents: 17211
diff changeset
54 ## @item @qcode{"spline"}
7184
2f915d6cac3d [project @ 2007-11-26 18:45:02 by jwe]
jwe
parents: 7183
diff changeset
55 ## Cubic spline interpolation---smooth first and second derivatives
7183
c0be321eb472 [project @ 2007-11-26 18:31:53 by jwe]
jwe
parents:
diff changeset
56 ## throughout the curve.
c0be321eb472 [project @ 2007-11-26 18:31:53 by jwe]
jwe
parents:
diff changeset
57 ## @end table
c0be321eb472 [project @ 2007-11-26 18:31:53 by jwe]
jwe
parents:
diff changeset
58 ##
17281
bc924baa2c4e doc: Add new @qcode macro for code samples which are quoted.
Rik <rik@octave.org>
parents: 17211
diff changeset
59 ## The default method is @qcode{"linear"}.
17077
f8b485d09ac6 ribbon.m, slice.m: Overhaul to use __plt_get_axis_arg__.
Rik <rik@octave.org>
parents: 15009
diff changeset
60 ##
17122
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 17077
diff changeset
61 ## If the first argument @var{hax} is an axes handle, then plot into this axis,
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 17077
diff changeset
62 ## rather than the current axes returned by @code{gca}.
14001
5f0bb45e615c doc: Update documentation for functions returning a graphics handle h (Bug #34761)
Rik <octave@nomad.inbox5.com>
parents: 11595
diff changeset
63 ##
5f0bb45e615c doc: Update documentation for functions returning a graphics handle h (Bug #34761)
Rik <octave@nomad.inbox5.com>
parents: 11595
diff changeset
64 ## The optional return value @var{h} is a graphics handle to the created
5f0bb45e615c doc: Update documentation for functions returning a graphics handle h (Bug #34761)
Rik <octave@nomad.inbox5.com>
parents: 11595
diff changeset
65 ## surface object.
7183
c0be321eb472 [project @ 2007-11-26 18:31:53 by jwe]
jwe
parents:
diff changeset
66 ##
c0be321eb472 [project @ 2007-11-26 18:31:53 by jwe]
jwe
parents:
diff changeset
67 ## Examples:
10821
693e22af08ae Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents: 10793
diff changeset
68 ##
7183
c0be321eb472 [project @ 2007-11-26 18:31:53 by jwe]
jwe
parents:
diff changeset
69 ## @example
9051
1bf0ce0930be Grammar check TexInfo in all .m files
Rik <rdrider0-list@yahoo.com>
parents: 9040
diff changeset
70 ## @group
7184
2f915d6cac3d [project @ 2007-11-26 18:45:02 by jwe]
jwe
parents: 7183
diff changeset
71 ## [x, y, z] = meshgrid (linspace (-8, 8, 32));
2f915d6cac3d [project @ 2007-11-26 18:45:02 by jwe]
jwe
parents: 7183
diff changeset
72 ## v = sin (sqrt (x.^2 + y.^2 + z.^2)) ./ (sqrt (x.^2 + y.^2 + z.^2));
2f915d6cac3d [project @ 2007-11-26 18:45:02 by jwe]
jwe
parents: 7183
diff changeset
73 ## slice (x, y, z, v, [], 0, []);
17077
f8b485d09ac6 ribbon.m, slice.m: Overhaul to use __plt_get_axis_arg__.
Rik <rik@octave.org>
parents: 15009
diff changeset
74 ##
7184
2f915d6cac3d [project @ 2007-11-26 18:45:02 by jwe]
jwe
parents: 7183
diff changeset
75 ## [xi, yi] = meshgrid (linspace (-7, 7));
2f915d6cac3d [project @ 2007-11-26 18:45:02 by jwe]
jwe
parents: 7183
diff changeset
76 ## zi = xi + yi;
2f915d6cac3d [project @ 2007-11-26 18:45:02 by jwe]
jwe
parents: 7183
diff changeset
77 ## slice (x, y, z, v, xi, yi, zi);
9051
1bf0ce0930be Grammar check TexInfo in all .m files
Rik <rdrider0-list@yahoo.com>
parents: 9040
diff changeset
78 ## @end group
7183
c0be321eb472 [project @ 2007-11-26 18:31:53 by jwe]
jwe
parents:
diff changeset
79 ## @end example
c0be321eb472 [project @ 2007-11-26 18:31:53 by jwe]
jwe
parents:
diff changeset
80 ## @seealso{interp3, surface, pcolor}
c0be321eb472 [project @ 2007-11-26 18:31:53 by jwe]
jwe
parents:
diff changeset
81 ## @end deftypefn
c0be321eb472 [project @ 2007-11-26 18:31:53 by jwe]
jwe
parents:
diff changeset
82
7184
2f915d6cac3d [project @ 2007-11-26 18:45:02 by jwe]
jwe
parents: 7183
diff changeset
83 ## Author: Kai Habel <kai.habel@gmx.de>
7183
c0be321eb472 [project @ 2007-11-26 18:31:53 by jwe]
jwe
parents:
diff changeset
84
7184
2f915d6cac3d [project @ 2007-11-26 18:45:02 by jwe]
jwe
parents: 7183
diff changeset
85 function h = slice (varargin)
7183
c0be321eb472 [project @ 2007-11-26 18:31:53 by jwe]
jwe
parents:
diff changeset
86
17077
f8b485d09ac6 ribbon.m, slice.m: Overhaul to use __plt_get_axis_arg__.
Rik <rik@octave.org>
parents: 15009
diff changeset
87 [hax, varargin, nargs] = __plt_get_axis_arg__ ("slice", varargin{:});
f8b485d09ac6 ribbon.m, slice.m: Overhaul to use __plt_get_axis_arg__.
Rik <rik@octave.org>
parents: 15009
diff changeset
88
7183
c0be321eb472 [project @ 2007-11-26 18:31:53 by jwe]
jwe
parents:
diff changeset
89 method = "linear";
c0be321eb472 [project @ 2007-11-26 18:31:53 by jwe]
jwe
parents:
diff changeset
90
c0be321eb472 [project @ 2007-11-26 18:31:53 by jwe]
jwe
parents:
diff changeset
91 if (ischar (varargin{end}))
c0be321eb472 [project @ 2007-11-26 18:31:53 by jwe]
jwe
parents:
diff changeset
92 method = varargin{end};
c0be321eb472 [project @ 2007-11-26 18:31:53 by jwe]
jwe
parents:
diff changeset
93 nargs -= 1;
c0be321eb472 [project @ 2007-11-26 18:31:53 by jwe]
jwe
parents:
diff changeset
94 endif
c0be321eb472 [project @ 2007-11-26 18:31:53 by jwe]
jwe
parents:
diff changeset
95
c0be321eb472 [project @ 2007-11-26 18:31:53 by jwe]
jwe
parents:
diff changeset
96 if (nargs == 4)
7184
2f915d6cac3d [project @ 2007-11-26 18:45:02 by jwe]
jwe
parents: 7183
diff changeset
97 v = varargin{1};
2f915d6cac3d [project @ 2007-11-26 18:45:02 by jwe]
jwe
parents: 7183
diff changeset
98 if (ndims (v) != 3)
17077
f8b485d09ac6 ribbon.m, slice.m: Overhaul to use __plt_get_axis_arg__.
Rik <rik@octave.org>
parents: 15009
diff changeset
99 error ("slice: V must be a 3-dimensional array of values");
7183
c0be321eb472 [project @ 2007-11-26 18:31:53 by jwe]
jwe
parents:
diff changeset
100 endif
7184
2f915d6cac3d [project @ 2007-11-26 18:45:02 by jwe]
jwe
parents: 7183
diff changeset
101 [nx, ny, nz] = size (v);
2f915d6cac3d [project @ 2007-11-26 18:45:02 by jwe]
jwe
parents: 7183
diff changeset
102 [x, y, z] = meshgrid (1:nx, 1:ny, 1:nz);
7183
c0be321eb472 [project @ 2007-11-26 18:31:53 by jwe]
jwe
parents:
diff changeset
103 sx = varargin{2};
c0be321eb472 [project @ 2007-11-26 18:31:53 by jwe]
jwe
parents:
diff changeset
104 sy = varargin{3};
c0be321eb472 [project @ 2007-11-26 18:31:53 by jwe]
jwe
parents:
diff changeset
105 sz = varargin{4};
c0be321eb472 [project @ 2007-11-26 18:31:53 by jwe]
jwe
parents:
diff changeset
106 elseif (nargs == 7)
7184
2f915d6cac3d [project @ 2007-11-26 18:45:02 by jwe]
jwe
parents: 7183
diff changeset
107 v = varargin{4};
2f915d6cac3d [project @ 2007-11-26 18:45:02 by jwe]
jwe
parents: 7183
diff changeset
108 if (ndims (v) != 3)
17077
f8b485d09ac6 ribbon.m, slice.m: Overhaul to use __plt_get_axis_arg__.
Rik <rik@octave.org>
parents: 15009
diff changeset
109 error ("slice: V must be a 3-dimensional array of values");
7183
c0be321eb472 [project @ 2007-11-26 18:31:53 by jwe]
jwe
parents:
diff changeset
110 endif
7184
2f915d6cac3d [project @ 2007-11-26 18:45:02 by jwe]
jwe
parents: 7183
diff changeset
111 x = varargin{1};
2f915d6cac3d [project @ 2007-11-26 18:45:02 by jwe]
jwe
parents: 7183
diff changeset
112 y = varargin{2};
2f915d6cac3d [project @ 2007-11-26 18:45:02 by jwe]
jwe
parents: 7183
diff changeset
113 z = varargin{3};
15009
6239f5806c26 Fix typos introduced by changeset 5d3a684236b0.
Rik <rik@octave.org>
parents: 14868
diff changeset
114 if (isvector (x) && isvector (y) && isvector (z))
7184
2f915d6cac3d [project @ 2007-11-26 18:45:02 by jwe]
jwe
parents: 7183
diff changeset
115 [x, y, z] = meshgrid (x, y, z);
7292
5e90111a28b3 [project @ 2007-12-11 18:13:34 by jwe]
jwe
parents: 7245
diff changeset
116 elseif (ndims (x) == 3 && size_equal (x, y, z))
7184
2f915d6cac3d [project @ 2007-11-26 18:45:02 by jwe]
jwe
parents: 7183
diff changeset
117 ## Do nothing.
7183
c0be321eb472 [project @ 2007-11-26 18:31:53 by jwe]
jwe
parents:
diff changeset
118 else
8664
e07e93c04080 style fixes
John W. Eaton <jwe@octave.org>
parents: 7292
diff changeset
119 error ("slice: X, Y, Z size mismatch");
7183
c0be321eb472 [project @ 2007-11-26 18:31:53 by jwe]
jwe
parents:
diff changeset
120 endif
c0be321eb472 [project @ 2007-11-26 18:31:53 by jwe]
jwe
parents:
diff changeset
121 sx = varargin{5};
c0be321eb472 [project @ 2007-11-26 18:31:53 by jwe]
jwe
parents:
diff changeset
122 sy = varargin{6};
c0be321eb472 [project @ 2007-11-26 18:31:53 by jwe]
jwe
parents:
diff changeset
123 sz = varargin{7};
c0be321eb472 [project @ 2007-11-26 18:31:53 by jwe]
jwe
parents:
diff changeset
124 else
7184
2f915d6cac3d [project @ 2007-11-26 18:45:02 by jwe]
jwe
parents: 7183
diff changeset
125 print_usage ();
7183
c0be321eb472 [project @ 2007-11-26 18:31:53 by jwe]
jwe
parents:
diff changeset
126 endif
c0be321eb472 [project @ 2007-11-26 18:31:53 by jwe]
jwe
parents:
diff changeset
127
7184
2f915d6cac3d [project @ 2007-11-26 18:45:02 by jwe]
jwe
parents: 7183
diff changeset
128 if (any ([isvector(sx), isvector(sy), isvector(sz)]))
2f915d6cac3d [project @ 2007-11-26 18:45:02 by jwe]
jwe
parents: 7183
diff changeset
129 have_sval = true;
14868
5d3a684236b0 maint: Use Octave coding conventions for cuddling parentheses in scripts directory
Rik <octave@nomad.inbox5.com>
parents: 14247
diff changeset
130 elseif (ndims (sx) == 2 && size_equal (sx, sy, sz))
7184
2f915d6cac3d [project @ 2007-11-26 18:45:02 by jwe]
jwe
parents: 7183
diff changeset
131 have_sval = false;
7183
c0be321eb472 [project @ 2007-11-26 18:31:53 by jwe]
jwe
parents:
diff changeset
132 else
7184
2f915d6cac3d [project @ 2007-11-26 18:45:02 by jwe]
jwe
parents: 7183
diff changeset
133 error ("slice: dimensional mismatch for (XI, YI, ZI) or (SX, SY, SZ)");
7183
c0be321eb472 [project @ 2007-11-26 18:31:53 by jwe]
jwe
parents:
diff changeset
134 endif
c0be321eb472 [project @ 2007-11-26 18:31:53 by jwe]
jwe
parents:
diff changeset
135
17211
87ba70043bfc Don't use ifelse in plot fcns to avoid unnecessary fcn evaluations.
Rik <rik@octave.org>
parents: 17126
diff changeset
136 oldfig = [];
17301
68bcac3c043a Correct inversion accidentally introduced in cset 87ba70043bfc.
Rik <rik@octave.org>
parents: 17281
diff changeset
137 if (! isempty (hax))
17211
87ba70043bfc Don't use ifelse in plot fcns to avoid unnecessary fcn evaluations.
Rik <rik@octave.org>
parents: 17126
diff changeset
138 oldfig = get (0, "currentfigure");
87ba70043bfc Don't use ifelse in plot fcns to avoid unnecessary fcn evaluations.
Rik <rik@octave.org>
parents: 17126
diff changeset
139 endif
17077
f8b485d09ac6 ribbon.m, slice.m: Overhaul to use __plt_get_axis_arg__.
Rik <rik@octave.org>
parents: 15009
diff changeset
140 unwind_protect
f8b485d09ac6 ribbon.m, slice.m: Overhaul to use __plt_get_axis_arg__.
Rik <rik@octave.org>
parents: 15009
diff changeset
141 hax = newplot (hax);
f8b485d09ac6 ribbon.m, slice.m: Overhaul to use __plt_get_axis_arg__.
Rik <rik@octave.org>
parents: 15009
diff changeset
142
f8b485d09ac6 ribbon.m, slice.m: Overhaul to use __plt_get_axis_arg__.
Rik <rik@octave.org>
parents: 15009
diff changeset
143 sidx = 1;
f8b485d09ac6 ribbon.m, slice.m: Overhaul to use __plt_get_axis_arg__.
Rik <rik@octave.org>
parents: 15009
diff changeset
144 minv = min (v(:));
f8b485d09ac6 ribbon.m, slice.m: Overhaul to use __plt_get_axis_arg__.
Rik <rik@octave.org>
parents: 15009
diff changeset
145 maxv = max (v(:));
f8b485d09ac6 ribbon.m, slice.m: Overhaul to use __plt_get_axis_arg__.
Rik <rik@octave.org>
parents: 15009
diff changeset
146 set (hax, "clim", [minv, maxv]);
f8b485d09ac6 ribbon.m, slice.m: Overhaul to use __plt_get_axis_arg__.
Rik <rik@octave.org>
parents: 15009
diff changeset
147
f8b485d09ac6 ribbon.m, slice.m: Overhaul to use __plt_get_axis_arg__.
Rik <rik@octave.org>
parents: 15009
diff changeset
148 if (have_sval)
f8b485d09ac6 ribbon.m, slice.m: Overhaul to use __plt_get_axis_arg__.
Rik <rik@octave.org>
parents: 15009
diff changeset
149 ns = length (sx) + length (sy) + length (sz);
f8b485d09ac6 ribbon.m, slice.m: Overhaul to use __plt_get_axis_arg__.
Rik <rik@octave.org>
parents: 15009
diff changeset
150 hs = zeros (ns,1);
f8b485d09ac6 ribbon.m, slice.m: Overhaul to use __plt_get_axis_arg__.
Rik <rik@octave.org>
parents: 15009
diff changeset
151 [ny, nx, nz] = size (v);
f8b485d09ac6 ribbon.m, slice.m: Overhaul to use __plt_get_axis_arg__.
Rik <rik@octave.org>
parents: 15009
diff changeset
152 if (length (sz) > 0)
f8b485d09ac6 ribbon.m, slice.m: Overhaul to use __plt_get_axis_arg__.
Rik <rik@octave.org>
parents: 15009
diff changeset
153 for i = 1:length (sz)
f8b485d09ac6 ribbon.m, slice.m: Overhaul to use __plt_get_axis_arg__.
Rik <rik@octave.org>
parents: 15009
diff changeset
154 [xi, yi, zi] = meshgrid (squeeze (x(1,:,1)),
f8b485d09ac6 ribbon.m, slice.m: Overhaul to use __plt_get_axis_arg__.
Rik <rik@octave.org>
parents: 15009
diff changeset
155 squeeze (y(:,1,1)), sz(i));
f8b485d09ac6 ribbon.m, slice.m: Overhaul to use __plt_get_axis_arg__.
Rik <rik@octave.org>
parents: 15009
diff changeset
156 vz = squeeze (interp3 (x, y, z, v, xi, yi, zi, method));
f8b485d09ac6 ribbon.m, slice.m: Overhaul to use __plt_get_axis_arg__.
Rik <rik@octave.org>
parents: 15009
diff changeset
157 htmp(sidx++) = surface (xi, yi, sz(i) * ones (size (yi)), vz);
f8b485d09ac6 ribbon.m, slice.m: Overhaul to use __plt_get_axis_arg__.
Rik <rik@octave.org>
parents: 15009
diff changeset
158 endfor
f8b485d09ac6 ribbon.m, slice.m: Overhaul to use __plt_get_axis_arg__.
Rik <rik@octave.org>
parents: 15009
diff changeset
159 endif
7183
c0be321eb472 [project @ 2007-11-26 18:31:53 by jwe]
jwe
parents:
diff changeset
160
17077
f8b485d09ac6 ribbon.m, slice.m: Overhaul to use __plt_get_axis_arg__.
Rik <rik@octave.org>
parents: 15009
diff changeset
161 if (length (sy) > 0)
f8b485d09ac6 ribbon.m, slice.m: Overhaul to use __plt_get_axis_arg__.
Rik <rik@octave.org>
parents: 15009
diff changeset
162 for i = length (sy):-1:1
19833
9fc020886ae9 maint: Clean up m-files to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19697
diff changeset
163 [xi, yi, zi] = meshgrid (squeeze (x(1,:,1)),
9fc020886ae9 maint: Clean up m-files to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19697
diff changeset
164 sy(i),
9fc020886ae9 maint: Clean up m-files to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19697
diff changeset
165 squeeze (z(1,1,:)));
17077
f8b485d09ac6 ribbon.m, slice.m: Overhaul to use __plt_get_axis_arg__.
Rik <rik@octave.org>
parents: 15009
diff changeset
166 vy = squeeze (interp3 (x, y, z, v, xi, yi, zi, method));
f8b485d09ac6 ribbon.m, slice.m: Overhaul to use __plt_get_axis_arg__.
Rik <rik@octave.org>
parents: 15009
diff changeset
167 htmp(sidx++) = surface (squeeze (xi),
17126
26589abbc78d Don't pass axis handle unnecessarily from high level to low level plot functions.
Rik <rik@octave.org>
parents: 17122
diff changeset
168 squeeze (sy(i) * ones (size (zi))),
26589abbc78d Don't pass axis handle unnecessarily from high level to low level plot functions.
Rik <rik@octave.org>
parents: 17122
diff changeset
169 squeeze (zi), vy);
17077
f8b485d09ac6 ribbon.m, slice.m: Overhaul to use __plt_get_axis_arg__.
Rik <rik@octave.org>
parents: 15009
diff changeset
170 endfor
f8b485d09ac6 ribbon.m, slice.m: Overhaul to use __plt_get_axis_arg__.
Rik <rik@octave.org>
parents: 15009
diff changeset
171 endif
f8b485d09ac6 ribbon.m, slice.m: Overhaul to use __plt_get_axis_arg__.
Rik <rik@octave.org>
parents: 15009
diff changeset
172
f8b485d09ac6 ribbon.m, slice.m: Overhaul to use __plt_get_axis_arg__.
Rik <rik@octave.org>
parents: 15009
diff changeset
173 if (length (sx) > 0)
f8b485d09ac6 ribbon.m, slice.m: Overhaul to use __plt_get_axis_arg__.
Rik <rik@octave.org>
parents: 15009
diff changeset
174 for i = length (sx):-1:1
f8b485d09ac6 ribbon.m, slice.m: Overhaul to use __plt_get_axis_arg__.
Rik <rik@octave.org>
parents: 15009
diff changeset
175 [xi, yi, zi] = meshgrid (sx(i), squeeze (y(:,1,1)), squeeze (z(1,1,:)));
f8b485d09ac6 ribbon.m, slice.m: Overhaul to use __plt_get_axis_arg__.
Rik <rik@octave.org>
parents: 15009
diff changeset
176 vx = squeeze (interp3 (x, y, z, v, xi, yi, zi, method));
f8b485d09ac6 ribbon.m, slice.m: Overhaul to use __plt_get_axis_arg__.
Rik <rik@octave.org>
parents: 15009
diff changeset
177 htmp(sidx++) = surface (squeeze (sx(i) * ones (size (zi))),
17126
26589abbc78d Don't pass axis handle unnecessarily from high level to low level plot functions.
Rik <rik@octave.org>
parents: 17122
diff changeset
178 squeeze (yi), squeeze(zi), vx);
17077
f8b485d09ac6 ribbon.m, slice.m: Overhaul to use __plt_get_axis_arg__.
Rik <rik@octave.org>
parents: 15009
diff changeset
179 endfor
f8b485d09ac6 ribbon.m, slice.m: Overhaul to use __plt_get_axis_arg__.
Rik <rik@octave.org>
parents: 15009
diff changeset
180 endif
f8b485d09ac6 ribbon.m, slice.m: Overhaul to use __plt_get_axis_arg__.
Rik <rik@octave.org>
parents: 15009
diff changeset
181 else
f8b485d09ac6 ribbon.m, slice.m: Overhaul to use __plt_get_axis_arg__.
Rik <rik@octave.org>
parents: 15009
diff changeset
182 vi = interp3 (x, y, z, v, sx, sy, sz);
f8b485d09ac6 ribbon.m, slice.m: Overhaul to use __plt_get_axis_arg__.
Rik <rik@octave.org>
parents: 15009
diff changeset
183 htmp = surface (sx, sy, sz, vi);
7183
c0be321eb472 [project @ 2007-11-26 18:31:53 by jwe]
jwe
parents:
diff changeset
184 endif
c0be321eb472 [project @ 2007-11-26 18:31:53 by jwe]
jwe
parents:
diff changeset
185
17077
f8b485d09ac6 ribbon.m, slice.m: Overhaul to use __plt_get_axis_arg__.
Rik <rik@octave.org>
parents: 15009
diff changeset
186 if (! ishold ())
f8b485d09ac6 ribbon.m, slice.m: Overhaul to use __plt_get_axis_arg__.
Rik <rik@octave.org>
parents: 15009
diff changeset
187 set (hax, "view", [-37.5, 30.0], "box", "off",
f8b485d09ac6 ribbon.m, slice.m: Overhaul to use __plt_get_axis_arg__.
Rik <rik@octave.org>
parents: 15009
diff changeset
188 "xgrid", "on", "ygrid", "on", "zgrid", "on");
7183
c0be321eb472 [project @ 2007-11-26 18:31:53 by jwe]
jwe
parents:
diff changeset
189 endif
c0be321eb472 [project @ 2007-11-26 18:31:53 by jwe]
jwe
parents:
diff changeset
190
17077
f8b485d09ac6 ribbon.m, slice.m: Overhaul to use __plt_get_axis_arg__.
Rik <rik@octave.org>
parents: 15009
diff changeset
191 unwind_protect_cleanup
f8b485d09ac6 ribbon.m, slice.m: Overhaul to use __plt_get_axis_arg__.
Rik <rik@octave.org>
parents: 15009
diff changeset
192 if (! isempty (oldfig))
f8b485d09ac6 ribbon.m, slice.m: Overhaul to use __plt_get_axis_arg__.
Rik <rik@octave.org>
parents: 15009
diff changeset
193 set (0, "currentfigure", oldfig);
7183
c0be321eb472 [project @ 2007-11-26 18:31:53 by jwe]
jwe
parents:
diff changeset
194 endif
17077
f8b485d09ac6 ribbon.m, slice.m: Overhaul to use __plt_get_axis_arg__.
Rik <rik@octave.org>
parents: 15009
diff changeset
195 end_unwind_protect
7183
c0be321eb472 [project @ 2007-11-26 18:31:53 by jwe]
jwe
parents:
diff changeset
196
c0be321eb472 [project @ 2007-11-26 18:31:53 by jwe]
jwe
parents:
diff changeset
197 if (nargout > 0)
17077
f8b485d09ac6 ribbon.m, slice.m: Overhaul to use __plt_get_axis_arg__.
Rik <rik@octave.org>
parents: 15009
diff changeset
198 h = htmp;
7183
c0be321eb472 [project @ 2007-11-26 18:31:53 by jwe]
jwe
parents:
diff changeset
199 endif
c0be321eb472 [project @ 2007-11-26 18:31:53 by jwe]
jwe
parents:
diff changeset
200
7184
2f915d6cac3d [project @ 2007-11-26 18:45:02 by jwe]
jwe
parents: 7183
diff changeset
201 endfunction
7245
d65670971cbc [project @ 2007-12-04 03:03:54 by jwe]
jwe
parents: 7184
diff changeset
202
14001
5f0bb45e615c doc: Update documentation for functions returning a graphics handle h (Bug #34761)
Rik <octave@nomad.inbox5.com>
parents: 11595
diff changeset
203
7245
d65670971cbc [project @ 2007-12-04 03:03:54 by jwe]
jwe
parents: 7184
diff changeset
204 %!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
205 %! clf;
14247
c4fa5e0b6193 test: Make surface demos reproducible by setting colormap to default at start of demo.
Rik <octave@nomad.inbox5.com>
parents: 14237
diff changeset
206 %! colormap ('default');
7245
d65670971cbc [project @ 2007-12-04 03:03:54 by jwe]
jwe
parents: 7184
diff changeset
207 %! [x, y, z] = meshgrid (linspace (-8, 8, 32));
d65670971cbc [project @ 2007-12-04 03:03:54 by jwe]
jwe
parents: 7184
diff changeset
208 %! v = sin (sqrt (x.^2 + y.^2 + z.^2)) ./ (sqrt (x.^2 + y.^2 + z.^2));
d65670971cbc [project @ 2007-12-04 03:03:54 by jwe]
jwe
parents: 7184
diff changeset
209 %! slice (x, y, z, v, [], 0, []);
14001
5f0bb45e615c doc: Update documentation for functions returning a graphics handle h (Bug #34761)
Rik <octave@nomad.inbox5.com>
parents: 11595
diff changeset
210
5f0bb45e615c doc: Update documentation for functions returning a graphics handle h (Bug #34761)
Rik <octave@nomad.inbox5.com>
parents: 11595
diff changeset
211 %!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
212 %! clf;
14247
c4fa5e0b6193 test: Make surface demos reproducible by setting colormap to default at start of demo.
Rik <octave@nomad.inbox5.com>
parents: 14237
diff changeset
213 %! colormap ('default');
14086
41511cce0488 test: Fix 2nd demo for slice() (bug #35143)
Rik <octave@nomad.inbox5.com>
parents: 14001
diff changeset
214 %! [x, y, z] = meshgrid (linspace (-8, 8, 32));
41511cce0488 test: Fix 2nd demo for slice() (bug #35143)
Rik <octave@nomad.inbox5.com>
parents: 14001
diff changeset
215 %! v = sin (sqrt (x.^2 + y.^2 + z.^2)) ./ (sqrt (x.^2 + y.^2 + z.^2));
7245
d65670971cbc [project @ 2007-12-04 03:03:54 by jwe]
jwe
parents: 7184
diff changeset
216 %! [xi, yi] = meshgrid (linspace (-7, 7));
d65670971cbc [project @ 2007-12-04 03:03:54 by jwe]
jwe
parents: 7184
diff changeset
217 %! zi = xi + yi;
d65670971cbc [project @ 2007-12-04 03:03:54 by jwe]
jwe
parents: 7184
diff changeset
218 %! slice (x, y, z, v, xi, yi, zi);
14001
5f0bb45e615c doc: Update documentation for functions returning a graphics handle h (Bug #34761)
Rik <octave@nomad.inbox5.com>
parents: 11595
diff changeset
219