Mercurial > hg > octave-lyh
annotate scripts/plot/slice.m @ 17194:c954b0a396a2
comet.m: Speed up animation by using low-level graphic commands.
* scripts/plot/comet.m: Speed up animation by using low-level graphic
commands.
author | Rik <rik@octave.org> |
---|---|
date | Mon, 05 Aug 2013 15:44:02 -0700 |
parents | 26589abbc78d |
children | 87ba70043bfc |
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 ## |
17126
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 |
eaab03308c0b
doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents:
17077
diff
changeset
|
32 ## the same size as the array @var{v} in the "meshgrid" format or vectors. The |
eaab03308c0b
doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents:
17077
diff
changeset
|
33 ## parameters @var{xi}, etc. respect a similar format to @var{x}, etc., and |
eaab03308c0b
doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents:
17077
diff
changeset
|
34 ## they represent the points at which the array @var{vi} is interpolated using |
eaab03308c0b
doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents:
17077
diff
changeset
|
35 ## interp3. The vectors @var{sx}, @var{sy}, and @var{sz} contain points of |
eaab03308c0b
doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents:
17077
diff
changeset
|
36 ## orthogonal slices of the respective axes. |
7183 | 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 | 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 | 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 | 43 ## |
11595
5ec6aa05638d
Prevent doubled quotes around @table items in Info.
Rik <octave@nomad.inbox5.com>
parents:
11587
diff
changeset
|
44 ## @table @asis |
7184 | 45 ## @item "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 ## |
7184 | 48 ## @item "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 ## |
7184 | 51 ## @item "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 ## |
7184 | 54 ## @item "spline" |
55 ## Cubic spline interpolation---smooth first and second derivatives | |
7183 | 56 ## throughout the curve. |
57 ## @end table | |
58 ## | |
17077
f8b485d09ac6
ribbon.m, slice.m: Overhaul to use __plt_get_axis_arg__.
Rik <rik@octave.org>
parents:
15009
diff
changeset
|
59 ## 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
|
60 ## |
17126
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 | 66 ## |
67 ## Examples: | |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
68 ## |
7183 | 69 ## @example |
9051
1bf0ce0930be
Grammar check TexInfo in all .m files
Rik <rdrider0-list@yahoo.com>
parents:
9040
diff
changeset
|
70 ## @group |
7184 | 71 ## [x, y, z] = meshgrid (linspace (-8, 8, 32)); |
72 ## v = sin (sqrt (x.^2 + y.^2 + z.^2)) ./ (sqrt (x.^2 + y.^2 + z.^2)); | |
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 | 75 ## [xi, yi] = meshgrid (linspace (-7, 7)); |
76 ## zi = xi + yi; | |
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 | 79 ## @end example |
80 ## @seealso{interp3, surface, pcolor} | |
81 ## @end deftypefn | |
82 | |
7184 | 83 ## Author: Kai Habel <kai.habel@gmx.de> |
7183 | 84 |
7184 | 85 function h = slice (varargin) |
7183 | 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 | 89 method = "linear"; |
90 | |
91 if (ischar (varargin{end})) | |
92 method = varargin{end}; | |
93 nargs -= 1; | |
94 endif | |
95 | |
96 if (nargs == 4) | |
7184 | 97 v = varargin{1}; |
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 | 100 endif |
7184 | 101 [nx, ny, nz] = size (v); |
102 [x, y, z] = meshgrid (1:nx, 1:ny, 1:nz); | |
7183 | 103 sx = varargin{2}; |
104 sy = varargin{3}; | |
105 sz = varargin{4}; | |
106 elseif (nargs == 7) | |
7184 | 107 v = varargin{4}; |
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 | 110 endif |
7184 | 111 x = varargin{1}; |
112 y = varargin{2}; | |
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 | 115 [x, y, z] = meshgrid (x, y, z); |
7292 | 116 elseif (ndims (x) == 3 && size_equal (x, y, z)) |
7184 | 117 ## Do nothing. |
7183 | 118 else |
8664 | 119 error ("slice: X, Y, Z size mismatch"); |
7183 | 120 endif |
121 sx = varargin{5}; | |
122 sy = varargin{6}; | |
123 sz = varargin{7}; | |
124 else | |
7184 | 125 print_usage (); |
7183 | 126 endif |
127 | |
7184 | 128 if (any ([isvector(sx), isvector(sy), isvector(sz)])) |
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 | 131 have_sval = false; |
7183 | 132 else |
7184 | 133 error ("slice: dimensional mismatch for (XI, YI, ZI) or (SX, SY, SZ)"); |
7183 | 134 endif |
135 | |
17077
f8b485d09ac6
ribbon.m, slice.m: Overhaul to use __plt_get_axis_arg__.
Rik <rik@octave.org>
parents:
15009
diff
changeset
|
136 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
|
137 unwind_protect |
f8b485d09ac6
ribbon.m, slice.m: Overhaul to use __plt_get_axis_arg__.
Rik <rik@octave.org>
parents:
15009
diff
changeset
|
138 hax = newplot (hax); |
f8b485d09ac6
ribbon.m, slice.m: Overhaul to use __plt_get_axis_arg__.
Rik <rik@octave.org>
parents:
15009
diff
changeset
|
139 |
f8b485d09ac6
ribbon.m, slice.m: Overhaul to use __plt_get_axis_arg__.
Rik <rik@octave.org>
parents:
15009
diff
changeset
|
140 sidx = 1; |
f8b485d09ac6
ribbon.m, slice.m: Overhaul to use __plt_get_axis_arg__.
Rik <rik@octave.org>
parents:
15009
diff
changeset
|
141 minv = min (v(:)); |
f8b485d09ac6
ribbon.m, slice.m: Overhaul to use __plt_get_axis_arg__.
Rik <rik@octave.org>
parents:
15009
diff
changeset
|
142 maxv = max (v(:)); |
f8b485d09ac6
ribbon.m, slice.m: Overhaul to use __plt_get_axis_arg__.
Rik <rik@octave.org>
parents:
15009
diff
changeset
|
143 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
|
144 |
f8b485d09ac6
ribbon.m, slice.m: Overhaul to use __plt_get_axis_arg__.
Rik <rik@octave.org>
parents:
15009
diff
changeset
|
145 if (have_sval) |
f8b485d09ac6
ribbon.m, slice.m: Overhaul to use __plt_get_axis_arg__.
Rik <rik@octave.org>
parents:
15009
diff
changeset
|
146 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
|
147 hs = zeros (ns,1); |
f8b485d09ac6
ribbon.m, slice.m: Overhaul to use __plt_get_axis_arg__.
Rik <rik@octave.org>
parents:
15009
diff
changeset
|
148 [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
|
149 if (length (sz) > 0) |
f8b485d09ac6
ribbon.m, slice.m: Overhaul to use __plt_get_axis_arg__.
Rik <rik@octave.org>
parents:
15009
diff
changeset
|
150 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
|
151 [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
|
152 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
|
153 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
|
154 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
|
155 endfor |
f8b485d09ac6
ribbon.m, slice.m: Overhaul to use __plt_get_axis_arg__.
Rik <rik@octave.org>
parents:
15009
diff
changeset
|
156 endif |
7183 | 157 |
17077
f8b485d09ac6
ribbon.m, slice.m: Overhaul to use __plt_get_axis_arg__.
Rik <rik@octave.org>
parents:
15009
diff
changeset
|
158 if (length (sy) > 0) |
f8b485d09ac6
ribbon.m, slice.m: Overhaul to use __plt_get_axis_arg__.
Rik <rik@octave.org>
parents:
15009
diff
changeset
|
159 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
|
160 [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
|
161 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
|
162 htmp(sidx++) = surface (squeeze (xi), |
17130
26589abbc78d
Don't pass axis handle unnecessarily from high level to low level plot functions.
Rik <rik@octave.org>
parents:
17126
diff
changeset
|
163 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:
17126
diff
changeset
|
164 squeeze (zi), vy); |
17077
f8b485d09ac6
ribbon.m, slice.m: Overhaul to use __plt_get_axis_arg__.
Rik <rik@octave.org>
parents:
15009
diff
changeset
|
165 endfor |
f8b485d09ac6
ribbon.m, slice.m: Overhaul to use __plt_get_axis_arg__.
Rik <rik@octave.org>
parents:
15009
diff
changeset
|
166 endif |
f8b485d09ac6
ribbon.m, slice.m: Overhaul to use __plt_get_axis_arg__.
Rik <rik@octave.org>
parents:
15009
diff
changeset
|
167 |
f8b485d09ac6
ribbon.m, slice.m: Overhaul to use __plt_get_axis_arg__.
Rik <rik@octave.org>
parents:
15009
diff
changeset
|
168 if (length (sx) > 0) |
f8b485d09ac6
ribbon.m, slice.m: Overhaul to use __plt_get_axis_arg__.
Rik <rik@octave.org>
parents:
15009
diff
changeset
|
169 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
|
170 [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
|
171 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
|
172 htmp(sidx++) = surface (squeeze (sx(i) * ones (size (zi))), |
17130
26589abbc78d
Don't pass axis handle unnecessarily from high level to low level plot functions.
Rik <rik@octave.org>
parents:
17126
diff
changeset
|
173 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
|
174 endfor |
f8b485d09ac6
ribbon.m, slice.m: Overhaul to use __plt_get_axis_arg__.
Rik <rik@octave.org>
parents:
15009
diff
changeset
|
175 endif |
f8b485d09ac6
ribbon.m, slice.m: Overhaul to use __plt_get_axis_arg__.
Rik <rik@octave.org>
parents:
15009
diff
changeset
|
176 else |
f8b485d09ac6
ribbon.m, slice.m: Overhaul to use __plt_get_axis_arg__.
Rik <rik@octave.org>
parents:
15009
diff
changeset
|
177 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
|
178 htmp = surface (sx, sy, sz, vi); |
7183 | 179 endif |
180 | |
17077
f8b485d09ac6
ribbon.m, slice.m: Overhaul to use __plt_get_axis_arg__.
Rik <rik@octave.org>
parents:
15009
diff
changeset
|
181 if (! ishold ()) |
f8b485d09ac6
ribbon.m, slice.m: Overhaul to use __plt_get_axis_arg__.
Rik <rik@octave.org>
parents:
15009
diff
changeset
|
182 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
|
183 "xgrid", "on", "ygrid", "on", "zgrid", "on"); |
7183 | 184 endif |
185 | |
17077
f8b485d09ac6
ribbon.m, slice.m: Overhaul to use __plt_get_axis_arg__.
Rik <rik@octave.org>
parents:
15009
diff
changeset
|
186 unwind_protect_cleanup |
f8b485d09ac6
ribbon.m, slice.m: Overhaul to use __plt_get_axis_arg__.
Rik <rik@octave.org>
parents:
15009
diff
changeset
|
187 if (! isempty (oldfig)) |
f8b485d09ac6
ribbon.m, slice.m: Overhaul to use __plt_get_axis_arg__.
Rik <rik@octave.org>
parents:
15009
diff
changeset
|
188 set (0, "currentfigure", oldfig); |
7183 | 189 endif |
17077
f8b485d09ac6
ribbon.m, slice.m: Overhaul to use __plt_get_axis_arg__.
Rik <rik@octave.org>
parents:
15009
diff
changeset
|
190 end_unwind_protect |
7183 | 191 |
192 if (nargout > 0) | |
17077
f8b485d09ac6
ribbon.m, slice.m: Overhaul to use __plt_get_axis_arg__.
Rik <rik@octave.org>
parents:
15009
diff
changeset
|
193 h = htmp; |
7183 | 194 endif |
195 | |
7184 | 196 endfunction |
7245 | 197 |
14001
5f0bb45e615c
doc: Update documentation for functions returning a graphics handle h (Bug #34761)
Rik <octave@nomad.inbox5.com>
parents:
11595
diff
changeset
|
198 |
7245 | 199 %!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
|
200 %! 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
|
201 %! colormap ('default'); |
7245 | 202 %! [x, y, z] = meshgrid (linspace (-8, 8, 32)); |
203 %! v = sin (sqrt (x.^2 + y.^2 + z.^2)) ./ (sqrt (x.^2 + y.^2 + z.^2)); | |
204 %! 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
|
205 |
5f0bb45e615c
doc: Update documentation for functions returning a graphics handle h (Bug #34761)
Rik <octave@nomad.inbox5.com>
parents:
11595
diff
changeset
|
206 %!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
|
207 %! 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
|
208 %! colormap ('default'); |
14086
41511cce0488
test: Fix 2nd demo for slice() (bug #35143)
Rik <octave@nomad.inbox5.com>
parents:
14001
diff
changeset
|
209 %! [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
|
210 %! v = sin (sqrt (x.^2 + y.^2 + z.^2)) ./ (sqrt (x.^2 + y.^2 + z.^2)); |
7245 | 211 %! [xi, yi] = meshgrid (linspace (-7, 7)); |
212 %! zi = xi + yi; | |
213 %! 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
|
214 |