Mercurial > hg > octave-lyh
annotate scripts/plot/slice.m @ 17077:f8b485d09ac6
ribbon.m, slice.m: Overhaul to use __plt_get_axis_arg__.
* scripts/plot/ribbon.m, scripts/plot/slice.m:
Overhaul to use __plt_get_axis_arg__. Redo docstring.
author | Rik <rik@octave.org> |
---|---|
date | Wed, 24 Jul 2013 23:12:46 -0700 |
parents | 6239f5806c26 |
children | eaab03308c0b |
rev | line source |
---|---|
14138
72c96de7a403
maint: update copyright notices for 2012
John W. Eaton <jwe@octave.org>
parents:
14089
diff
changeset
|
1 ## Copyright (C) 2007-2012 Kai Habel, David Bateman |
7183 | 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 -*- | |
10793
be55736a0783
Grammarcheck the documentation from m-files.
Rik <octave@nomad.inbox5.com>
parents:
10549
diff
changeset
|
20 ## @deftypefn {Function File} {} slice (@var{x}, @var{y}, @var{z}, @var{v}, @var{sx}, @var{sy}, @var{sz}) |
7184 | 21 ## @deftypefnx {Function File} {} slice (@var{x}, @var{y}, @var{z}, @var{v}, @var{xi}, @var{yi}, @var{zi}) |
22 ## @deftypefnx {Function File} {} slice (@var{v}, @var{sx}, @var{sy}, @var{sz}) | |
23 ## @deftypefnx {Function File} {} slice (@var{v}, @var{xi}, @var{yi}, @var{zi}) | |
17077
f8b485d09ac6
ribbon.m, slice.m: Overhaul to use __plt_get_axis_arg__.
Rik <rik@octave.org>
parents:
15009
diff
changeset
|
24 ## @deftypefnx {Function File} {} slice (@dots{}, @var{method}) |
f8b485d09ac6
ribbon.m, slice.m: Overhaul to use __plt_get_axis_arg__.
Rik <rik@octave.org>
parents:
15009
diff
changeset
|
25 ## @deftypefnx {Function File} {} slice (@var{hax}, @dots{}) |
7184 | 26 ## @deftypefnx {Function File} {@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 ## |
f8b485d09ac6
ribbon.m, slice.m: Overhaul to use __plt_get_axis_arg__.
Rik <rik@octave.org>
parents:
15009
diff
changeset
|
29 ## Each element of the 3-dimensional |
7184 | 30 ## array @var{v} represents a scalar value at a location given by the |
9040
dbd0c77e575e
Cleanup documentation file plot.texi
Rik <rdrider0-list@yahoo.com>
parents:
8920
diff
changeset
|
31 ## parameters @var{x}, @var{y}, and @var{z}. The parameters @var{x}, |
7184 | 32 ## @var{x}, and @var{z} are either 3-dimensional arrays of the same size |
9040
dbd0c77e575e
Cleanup documentation file plot.texi
Rik <rdrider0-list@yahoo.com>
parents:
8920
diff
changeset
|
33 ## as the array @var{v} in the "meshgrid" format or vectors. The |
9209
923c7cb7f13f
Simplify TeXinfo files by eliminating redundant @iftex followed by @tex construction.
Rik <rdrider0-list@yahoo.com>
parents:
9051
diff
changeset
|
34 ## parameters @var{xi}, etc. respect a similar format to @var{x}, etc., |
7184 | 35 ## and they represent the points at which the array @var{vi} is |
9051
1bf0ce0930be
Grammar check TexInfo in all .m files
Rik <rdrider0-list@yahoo.com>
parents:
9040
diff
changeset
|
36 ## interpolated using interp3. The vectors @var{sx}, @var{sy}, and |
7184 | 37 ## @var{sz} contain points of orthogonal slices of the respective axes. |
7183 | 38 ## |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11563
diff
changeset
|
39 ## If @var{x}, @var{y}, @var{z} are omitted, they are assumed to be |
7184 | 40 ## @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
|
41 ## @code{z = 1:size (@var{v}, 3)}. |
7183 | 42 ## |
17077
f8b485d09ac6
ribbon.m, slice.m: Overhaul to use __plt_get_axis_arg__.
Rik <rik@octave.org>
parents:
15009
diff
changeset
|
43 ## @var{method} is one of: |
7183 | 44 ## |
11595
5ec6aa05638d
Prevent doubled quotes around @table items in Info.
Rik <octave@nomad.inbox5.com>
parents:
11587
diff
changeset
|
45 ## @table @asis |
7184 | 46 ## @item "nearest" |
9040
dbd0c77e575e
Cleanup documentation file plot.texi
Rik <rdrider0-list@yahoo.com>
parents:
8920
diff
changeset
|
47 ## Return the nearest neighbor. |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
48 ## |
7184 | 49 ## @item "linear" |
9040
dbd0c77e575e
Cleanup documentation file plot.texi
Rik <rdrider0-list@yahoo.com>
parents:
8920
diff
changeset
|
50 ## Linear interpolation from nearest neighbors. |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
51 ## |
7184 | 52 ## @item "cubic" |
9040
dbd0c77e575e
Cleanup documentation file plot.texi
Rik <rdrider0-list@yahoo.com>
parents:
8920
diff
changeset
|
53 ## 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
|
54 ## |
7184 | 55 ## @item "spline" |
56 ## Cubic spline interpolation---smooth first and second derivatives | |
7183 | 57 ## throughout the curve. |
58 ## @end table | |
59 ## | |
17077
f8b485d09ac6
ribbon.m, slice.m: Overhaul to use __plt_get_axis_arg__.
Rik <rik@octave.org>
parents:
15009
diff
changeset
|
60 ## The default method is "linear". |
f8b485d09ac6
ribbon.m, slice.m: Overhaul to use __plt_get_axis_arg__.
Rik <rik@octave.org>
parents:
15009
diff
changeset
|
61 ## |
f8b485d09ac6
ribbon.m, slice.m: Overhaul to use __plt_get_axis_arg__.
Rik <rik@octave.org>
parents:
15009
diff
changeset
|
62 ## If the first argument @var{hax} is an axis handle, then plot into this axis, |
f8b485d09ac6
ribbon.m, slice.m: Overhaul to use __plt_get_axis_arg__.
Rik <rik@octave.org>
parents:
15009
diff
changeset
|
63 ## rather than the current axis handle 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
|
64 ## |
5f0bb45e615c
doc: Update documentation for functions returning a graphics handle h (Bug #34761)
Rik <octave@nomad.inbox5.com>
parents:
11595
diff
changeset
|
65 ## 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
|
66 ## surface object. |
7183 | 67 ## |
68 ## Examples: | |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
69 ## |
7183 | 70 ## @example |
9051
1bf0ce0930be
Grammar check TexInfo in all .m files
Rik <rdrider0-list@yahoo.com>
parents:
9040
diff
changeset
|
71 ## @group |
7184 | 72 ## [x, y, z] = meshgrid (linspace (-8, 8, 32)); |
73 ## v = sin (sqrt (x.^2 + y.^2 + z.^2)) ./ (sqrt (x.^2 + y.^2 + z.^2)); | |
74 ## 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
|
75 ## |
7184 | 76 ## [xi, yi] = meshgrid (linspace (-7, 7)); |
77 ## zi = xi + yi; | |
78 ## 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
|
79 ## @end group |
7183 | 80 ## @end example |
81 ## @seealso{interp3, surface, pcolor} | |
82 ## @end deftypefn | |
83 | |
7184 | 84 ## Author: Kai Habel <kai.habel@gmx.de> |
7183 | 85 |
7184 | 86 function h = slice (varargin) |
7183 | 87 |
17077
f8b485d09ac6
ribbon.m, slice.m: Overhaul to use __plt_get_axis_arg__.
Rik <rik@octave.org>
parents:
15009
diff
changeset
|
88 [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
|
89 |
7183 | 90 method = "linear"; |
91 | |
92 if (ischar (varargin{end})) | |
93 method = varargin{end}; | |
94 nargs -= 1; | |
95 endif | |
96 | |
97 if (nargs == 4) | |
7184 | 98 v = varargin{1}; |
99 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
|
100 error ("slice: V must be a 3-dimensional array of values"); |
7183 | 101 endif |
7184 | 102 [nx, ny, nz] = size (v); |
103 [x, y, z] = meshgrid (1:nx, 1:ny, 1:nz); | |
7183 | 104 sx = varargin{2}; |
105 sy = varargin{3}; | |
106 sz = varargin{4}; | |
107 elseif (nargs == 7) | |
7184 | 108 v = varargin{4}; |
109 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
|
110 error ("slice: V must be a 3-dimensional array of values"); |
7183 | 111 endif |
7184 | 112 x = varargin{1}; |
113 y = varargin{2}; | |
114 z = varargin{3}; | |
15009
6239f5806c26
Fix typos introduced by changeset 5d3a684236b0.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
115 if (isvector (x) && isvector (y) && isvector (z)) |
7184 | 116 [x, y, z] = meshgrid (x, y, z); |
7292 | 117 elseif (ndims (x) == 3 && size_equal (x, y, z)) |
7184 | 118 ## Do nothing. |
7183 | 119 else |
8664 | 120 error ("slice: X, Y, Z size mismatch"); |
7183 | 121 endif |
122 sx = varargin{5}; | |
123 sy = varargin{6}; | |
124 sz = varargin{7}; | |
125 else | |
7184 | 126 print_usage (); |
7183 | 127 endif |
128 | |
7184 | 129 if (any ([isvector(sx), isvector(sy), isvector(sz)])) |
130 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
|
131 elseif (ndims (sx) == 2 && size_equal (sx, sy, sz)) |
7184 | 132 have_sval = false; |
7183 | 133 else |
7184 | 134 error ("slice: dimensional mismatch for (XI, YI, ZI) or (SX, SY, SZ)"); |
7183 | 135 endif |
136 | |
17077
f8b485d09ac6
ribbon.m, slice.m: Overhaul to use __plt_get_axis_arg__.
Rik <rik@octave.org>
parents:
15009
diff
changeset
|
137 oldfig = ifelse (isempty (hax), [], get (0, "currentfigure")); |
f8b485d09ac6
ribbon.m, slice.m: Overhaul to use __plt_get_axis_arg__.
Rik <rik@octave.org>
parents:
15009
diff
changeset
|
138 unwind_protect |
f8b485d09ac6
ribbon.m, slice.m: Overhaul to use __plt_get_axis_arg__.
Rik <rik@octave.org>
parents:
15009
diff
changeset
|
139 hax = newplot (hax); |
f8b485d09ac6
ribbon.m, slice.m: Overhaul to use __plt_get_axis_arg__.
Rik <rik@octave.org>
parents:
15009
diff
changeset
|
140 |
f8b485d09ac6
ribbon.m, slice.m: Overhaul to use __plt_get_axis_arg__.
Rik <rik@octave.org>
parents:
15009
diff
changeset
|
141 sidx = 1; |
f8b485d09ac6
ribbon.m, slice.m: Overhaul to use __plt_get_axis_arg__.
Rik <rik@octave.org>
parents:
15009
diff
changeset
|
142 minv = min (v(:)); |
f8b485d09ac6
ribbon.m, slice.m: Overhaul to use __plt_get_axis_arg__.
Rik <rik@octave.org>
parents:
15009
diff
changeset
|
143 maxv = max (v(:)); |
f8b485d09ac6
ribbon.m, slice.m: Overhaul to use __plt_get_axis_arg__.
Rik <rik@octave.org>
parents:
15009
diff
changeset
|
144 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
|
145 |
f8b485d09ac6
ribbon.m, slice.m: Overhaul to use __plt_get_axis_arg__.
Rik <rik@octave.org>
parents:
15009
diff
changeset
|
146 if (have_sval) |
f8b485d09ac6
ribbon.m, slice.m: Overhaul to use __plt_get_axis_arg__.
Rik <rik@octave.org>
parents:
15009
diff
changeset
|
147 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
|
148 hs = zeros (ns,1); |
f8b485d09ac6
ribbon.m, slice.m: Overhaul to use __plt_get_axis_arg__.
Rik <rik@octave.org>
parents:
15009
diff
changeset
|
149 [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
|
150 if (length (sz) > 0) |
f8b485d09ac6
ribbon.m, slice.m: Overhaul to use __plt_get_axis_arg__.
Rik <rik@octave.org>
parents:
15009
diff
changeset
|
151 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
|
152 [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
|
153 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
|
154 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
|
155 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
|
156 endfor |
f8b485d09ac6
ribbon.m, slice.m: Overhaul to use __plt_get_axis_arg__.
Rik <rik@octave.org>
parents:
15009
diff
changeset
|
157 endif |
7183 | 158 |
17077
f8b485d09ac6
ribbon.m, slice.m: Overhaul to use __plt_get_axis_arg__.
Rik <rik@octave.org>
parents:
15009
diff
changeset
|
159 if (length (sy) > 0) |
f8b485d09ac6
ribbon.m, slice.m: Overhaul to use __plt_get_axis_arg__.
Rik <rik@octave.org>
parents:
15009
diff
changeset
|
160 for i = length (sy):-1:1 |
f8b485d09ac6
ribbon.m, slice.m: Overhaul to use __plt_get_axis_arg__.
Rik <rik@octave.org>
parents:
15009
diff
changeset
|
161 [xi, yi, zi] = meshgrid (squeeze (x(1,:,1)), sy(i), squeeze (z(1,1,:))); |
f8b485d09ac6
ribbon.m, slice.m: Overhaul to use __plt_get_axis_arg__.
Rik <rik@octave.org>
parents:
15009
diff
changeset
|
162 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
|
163 htmp(sidx++) = surface (squeeze (xi), |
f8b485d09ac6
ribbon.m, slice.m: Overhaul to use __plt_get_axis_arg__.
Rik <rik@octave.org>
parents:
15009
diff
changeset
|
164 squeeze (sy(i) * ones (size (zi))), |
f8b485d09ac6
ribbon.m, slice.m: Overhaul to use __plt_get_axis_arg__.
Rik <rik@octave.org>
parents:
15009
diff
changeset
|
165 squeeze (zi), vy); |
f8b485d09ac6
ribbon.m, slice.m: Overhaul to use __plt_get_axis_arg__.
Rik <rik@octave.org>
parents:
15009
diff
changeset
|
166 endfor |
f8b485d09ac6
ribbon.m, slice.m: Overhaul to use __plt_get_axis_arg__.
Rik <rik@octave.org>
parents:
15009
diff
changeset
|
167 endif |
f8b485d09ac6
ribbon.m, slice.m: Overhaul to use __plt_get_axis_arg__.
Rik <rik@octave.org>
parents:
15009
diff
changeset
|
168 |
f8b485d09ac6
ribbon.m, slice.m: Overhaul to use __plt_get_axis_arg__.
Rik <rik@octave.org>
parents:
15009
diff
changeset
|
169 if (length (sx) > 0) |
f8b485d09ac6
ribbon.m, slice.m: Overhaul to use __plt_get_axis_arg__.
Rik <rik@octave.org>
parents:
15009
diff
changeset
|
170 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
|
171 [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
|
172 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
|
173 htmp(sidx++) = surface (squeeze (sx(i) * ones (size (zi))), |
f8b485d09ac6
ribbon.m, slice.m: Overhaul to use __plt_get_axis_arg__.
Rik <rik@octave.org>
parents:
15009
diff
changeset
|
174 squeeze (yi), squeeze(zi), vx); |
f8b485d09ac6
ribbon.m, slice.m: Overhaul to use __plt_get_axis_arg__.
Rik <rik@octave.org>
parents:
15009
diff
changeset
|
175 endfor |
f8b485d09ac6
ribbon.m, slice.m: Overhaul to use __plt_get_axis_arg__.
Rik <rik@octave.org>
parents:
15009
diff
changeset
|
176 endif |
f8b485d09ac6
ribbon.m, slice.m: Overhaul to use __plt_get_axis_arg__.
Rik <rik@octave.org>
parents:
15009
diff
changeset
|
177 else |
f8b485d09ac6
ribbon.m, slice.m: Overhaul to use __plt_get_axis_arg__.
Rik <rik@octave.org>
parents:
15009
diff
changeset
|
178 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
|
179 htmp = surface (sx, sy, sz, vi); |
7183 | 180 endif |
181 | |
17077
f8b485d09ac6
ribbon.m, slice.m: Overhaul to use __plt_get_axis_arg__.
Rik <rik@octave.org>
parents:
15009
diff
changeset
|
182 if (! ishold ()) |
f8b485d09ac6
ribbon.m, slice.m: Overhaul to use __plt_get_axis_arg__.
Rik <rik@octave.org>
parents:
15009
diff
changeset
|
183 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
|
184 "xgrid", "on", "ygrid", "on", "zgrid", "on"); |
7183 | 185 endif |
186 | |
17077
f8b485d09ac6
ribbon.m, slice.m: Overhaul to use __plt_get_axis_arg__.
Rik <rik@octave.org>
parents:
15009
diff
changeset
|
187 unwind_protect_cleanup |
f8b485d09ac6
ribbon.m, slice.m: Overhaul to use __plt_get_axis_arg__.
Rik <rik@octave.org>
parents:
15009
diff
changeset
|
188 if (! isempty (oldfig)) |
f8b485d09ac6
ribbon.m, slice.m: Overhaul to use __plt_get_axis_arg__.
Rik <rik@octave.org>
parents:
15009
diff
changeset
|
189 set (0, "currentfigure", oldfig); |
7183 | 190 endif |
17077
f8b485d09ac6
ribbon.m, slice.m: Overhaul to use __plt_get_axis_arg__.
Rik <rik@octave.org>
parents:
15009
diff
changeset
|
191 end_unwind_protect |
7183 | 192 |
193 if (nargout > 0) | |
17077
f8b485d09ac6
ribbon.m, slice.m: Overhaul to use __plt_get_axis_arg__.
Rik <rik@octave.org>
parents:
15009
diff
changeset
|
194 h = htmp; |
7183 | 195 endif |
196 | |
7184 | 197 endfunction |
7245 | 198 |
14001
5f0bb45e615c
doc: Update documentation for functions returning a graphics handle h (Bug #34761)
Rik <octave@nomad.inbox5.com>
parents:
11595
diff
changeset
|
199 |
7245 | 200 %!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
|
201 %! 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
|
202 %! colormap ('default'); |
7245 | 203 %! [x, y, z] = meshgrid (linspace (-8, 8, 32)); |
204 %! v = sin (sqrt (x.^2 + y.^2 + z.^2)) ./ (sqrt (x.^2 + y.^2 + z.^2)); | |
205 %! 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
|
206 |
5f0bb45e615c
doc: Update documentation for functions returning a graphics handle h (Bug #34761)
Rik <octave@nomad.inbox5.com>
parents:
11595
diff
changeset
|
207 %!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
|
208 %! 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
|
209 %! colormap ('default'); |
14086
41511cce0488
test: Fix 2nd demo for slice() (bug #35143)
Rik <octave@nomad.inbox5.com>
parents:
14001
diff
changeset
|
210 %! [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
|
211 %! v = sin (sqrt (x.^2 + y.^2 + z.^2)) ./ (sqrt (x.^2 + y.^2 + z.^2)); |
7245 | 212 %! [xi, yi] = meshgrid (linspace (-7, 7)); |
213 %! zi = xi + yi; | |
214 %! 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
|
215 |