Mercurial > hg > octave-nkf
annotate scripts/plot/draw/trisurf.m @ 17874:28e9562d708b
Fix display of '{}' for empty cells in GUI Variable window.
* libinterp/octave-value/ov-cell.cc(short_disp): Use parentheses around tertiary
operator expression so that C++ stream operator '<<' doesn't grab result of
test, rather than output of test.
author | Rik <rik@octave.org> |
---|---|
date | Thu, 07 Nov 2013 09:54:38 -0800 |
parents | d63878346099 |
children | 446c46af4b42 |
rev | line source |
---|---|
17744
d63878346099
maint: Update copyright notices for release.
John W. Eaton <jwe@octave.org>
parents:
17572
diff
changeset
|
1 ## Copyright (C) 2007-2013 David Bateman |
9110
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
2 ## |
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
3 ## This file is part of Octave. |
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
4 ## |
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
5 ## Octave is free software; you can redistribute it and/or modify it |
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
6 ## under the terms of the GNU General Public License as published by |
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
7 ## the Free Software Foundation; either version 3 of the License, or (at |
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
8 ## your option) any later version. |
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
9 ## |
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
10 ## Octave is distributed in the hope that it will be useful, but |
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
11 ## WITHOUT ANY WARRANTY; without even the implied warranty of |
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
13 ## General Public License for more details. |
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
14 ## |
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
15 ## You should have received a copy of the GNU General Public License |
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
16 ## along with Octave; see the file COPYING. If not, see |
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
17 ## <http://www.gnu.org/licenses/>. |
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
18 |
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
19 ## -*- texinfo -*- |
17122
eaab03308c0b
doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents:
17021
diff
changeset
|
20 ## @deftypefn {Function File} {} trisurf (@var{tri}, @var{x}, @var{y}, @var{z}, @var{c}) |
eaab03308c0b
doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents:
17021
diff
changeset
|
21 ## @deftypefnx {Function File} {} trisurf (@var{tri}, @var{x}, @var{y}, @var{z}) |
eaab03308c0b
doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents:
17021
diff
changeset
|
22 ## @deftypefnx {Function File} {} trisurf (@dots{}, @var{prop}, @var{val}, @dots{}) |
9110
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
23 ## @deftypefnx {Function File} {@var{h} =} trisurf (@dots{}) |
17122
eaab03308c0b
doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents:
17021
diff
changeset
|
24 ## Plot a 3-D triangular surface. |
eaab03308c0b
doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents:
17021
diff
changeset
|
25 ## |
eaab03308c0b
doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents:
17021
diff
changeset
|
26 ## In contrast to @code{surf}, which plots a surface mesh using rectangles, |
eaab03308c0b
doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents:
17021
diff
changeset
|
27 ## @code{trisurf} plots the mesh using triangles. |
14001
5f0bb45e615c
doc: Update documentation for functions returning a graphics handle h (Bug #34761)
Rik <octave@nomad.inbox5.com>
parents:
13747
diff
changeset
|
28 ## |
17122
eaab03308c0b
doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents:
17021
diff
changeset
|
29 ## @var{tri} is typically the output of a Delaunay triangulation over the |
eaab03308c0b
doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents:
17021
diff
changeset
|
30 ## grid of @var{x}, @var{y}. Every row of @var{tri} represents one triangle |
eaab03308c0b
doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents:
17021
diff
changeset
|
31 ## and contains three indices into [@var{x}, @var{y}] which are the |
eaab03308c0b
doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents:
17021
diff
changeset
|
32 ## vertices of the triangles in the x-y plane. @var{z} determines the |
eaab03308c0b
doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents:
17021
diff
changeset
|
33 ## height above the plane of each vertex. |
eaab03308c0b
doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents:
17021
diff
changeset
|
34 ## |
eaab03308c0b
doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents:
17021
diff
changeset
|
35 ## The color of the trimesh is computed by linearly scaling the @var{z} values |
eaab03308c0b
doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents:
17021
diff
changeset
|
36 ## to fit the range of the current colormap. Use @code{caxis} and/or |
eaab03308c0b
doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents:
17021
diff
changeset
|
37 ## change the colormap to control the appearance. |
eaab03308c0b
doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents:
17021
diff
changeset
|
38 ## |
eaab03308c0b
doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents:
17021
diff
changeset
|
39 ## Optionally, the color of the mesh can be specified independently of @var{z} |
17440 | 40 ## by supplying a color matrix, @var{c}. If @var{z} has N elements, then |
41 ## @var{c} should be an Nx1 vector for colormap data or an Nx3 matrix for | |
42 ## RGB data. | |
17122
eaab03308c0b
doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents:
17021
diff
changeset
|
43 ## |
eaab03308c0b
doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents:
17021
diff
changeset
|
44 ## Any property/value pairs are passed directly to the underlying patch object. |
eaab03308c0b
doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents:
17021
diff
changeset
|
45 ## |
eaab03308c0b
doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents:
17021
diff
changeset
|
46 ## The optional return value @var{h} is a graphics handle to the created patch |
eaab03308c0b
doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents:
17021
diff
changeset
|
47 ## object. |
eaab03308c0b
doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents:
17021
diff
changeset
|
48 ## @seealso{surf, triplot, trimesh, delaunay, patch, shading} |
9110
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
49 ## @end deftypefn |
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
50 |
13747
e8564e8b0043
Restore random number state after %!demos or %!tests
Rik <octave@nomad.inbox5.com>
parents:
13141
diff
changeset
|
51 function h = trisurf (tri, x, y, z, varargin) |
9110
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
52 |
17440 | 53 if (nargin < 4) |
9110
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
54 print_usage (); |
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
55 endif |
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
56 |
17440 | 57 if (nargin > 4 && isnumeric (varargin{1})) |
58 c = varargin{1}; | |
59 varargin(1) = []; | |
60 if (isvector (c)) | |
61 if (numel (c) != numel (z)) | |
62 error ("trisurf: C must have 'numel (Z)' elements"); | |
63 endif | |
64 c = c(:); | |
65 elseif (rows (c) != numel (z) || columns (c) != 3) | |
66 error ("trisurf: TrueColor C matrix must be 'numel (Z)' rows by 3 columns"); | |
12524
482cf3aad915
trisurf.m: Set default edgecolor as Matlab does. Add demos.
Ben Abbott <bpabbott@mac.com>
parents:
12187
diff
changeset
|
67 endif |
17440 | 68 else |
69 c = z(:); | |
70 endif | |
71 ## FIXME: Is all this extra input parsing necessary? | |
72 ## Is it for Matlab compatibility? | |
73 if (! any (strcmpi (varargin, "FaceColor"))) | |
74 nfc = numel (varargin) + 1; | |
75 varargin(nfc+(0:1)) = {"FaceColor", "flat"}; | |
76 else | |
77 nfc = find (any (strcmpi (varargin, "FaceColor")), 1); | |
78 endif | |
79 if (! any (strcmpi (varargin, "EdgeColor")) | |
80 && strcmpi (varargin{nfc+1}, "interp")) | |
81 varargin(end+(1:2)) = {"EdgeColor", "none"}; | |
82 endif | |
9110
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
83 |
17440 | 84 hax = newplot (); |
85 | |
86 htmp = patch ("Faces", tri, "Vertices", [x(:), y(:), z(:)], | |
87 "FaceVertexCData", c, varargin{:}); | |
88 | |
89 if (! ishold ()) | |
90 set (hax, "view", [-37.5, 30], "box", "off", | |
91 "xgrid", "on", "ygrid", "on", "zgrid", "on"); | |
92 endif | |
93 | |
94 if (nargout > 0) | |
95 h = htmp; | |
9110
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
96 endif |
13747
e8564e8b0043
Restore random number state after %!demos or %!tests
Rik <octave@nomad.inbox5.com>
parents:
13141
diff
changeset
|
97 |
9110
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
98 endfunction |
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
99 |
14237
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
100 |
14108 | 101 %!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
|
102 %! clf; |
14247
c4fa5e0b6193
test: Make surface demos reproducible by setting colormap to default at start of demo.
Rik <octave@nomad.inbox5.com>
parents:
14245
diff
changeset
|
103 %! colormap ('default'); |
14108 | 104 %! N = 31; |
105 %! [x, y] = meshgrid (1:N); | |
17021
154899fa42e3
trisurf.m: Fix incorrect delaunay syntax in %!demo blocks
Rik <rik@octave.org>
parents:
14846
diff
changeset
|
106 %! tri = delaunay (x(:), y(:)); |
14108 | 107 %! z = peaks (N); |
14245
4506eade9f04
Use Matlab coding conventions for demos in plot/ directory.
Rik <octave@nomad.inbox5.com>
parents:
14237
diff
changeset
|
108 %! h = trisurf (tri, x, y, z, 'facecolor', 'interp'); |
14237
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
109 %! axis tight; |
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
110 %! zlim auto; |
14245
4506eade9f04
Use Matlab coding conventions for demos in plot/ directory.
Rik <octave@nomad.inbox5.com>
parents:
14237
diff
changeset
|
111 %! title (sprintf ('facecolor = %s', get (h, 'facecolor'))); |
14108 | 112 |
113 %!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
|
114 %! clf; |
14247
c4fa5e0b6193
test: Make surface demos reproducible by setting colormap to default at start of demo.
Rik <octave@nomad.inbox5.com>
parents:
14245
diff
changeset
|
115 %! colormap ('default'); |
14108 | 116 %! N = 31; |
117 %! [x, y] = meshgrid (1:N); | |
17021
154899fa42e3
trisurf.m: Fix incorrect delaunay syntax in %!demo blocks
Rik <rik@octave.org>
parents:
14846
diff
changeset
|
118 %! tri = delaunay (x(:), y(:)); |
14108 | 119 %! z = peaks (N); |
14245
4506eade9f04
Use Matlab coding conventions for demos in plot/ directory.
Rik <octave@nomad.inbox5.com>
parents:
14237
diff
changeset
|
120 %! h = trisurf (tri, x, y, z, 'facecolor', 'flat'); |
14237
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
121 %! axis tight; |
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
122 %! zlim auto; |
14245
4506eade9f04
Use Matlab coding conventions for demos in plot/ directory.
Rik <octave@nomad.inbox5.com>
parents:
14237
diff
changeset
|
123 %! title (sprintf ('facecolor = %s', get (h, 'facecolor'))); |
13747
e8564e8b0043
Restore random number state after %!demos or %!tests
Rik <octave@nomad.inbox5.com>
parents:
13141
diff
changeset
|
124 |
9110
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
125 %!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
|
126 %! clf; |
14247
c4fa5e0b6193
test: Make surface demos reproducible by setting colormap to default at start of demo.
Rik <octave@nomad.inbox5.com>
parents:
14245
diff
changeset
|
127 %! colormap ('default'); |
14245
4506eade9f04
Use Matlab coding conventions for demos in plot/ directory.
Rik <octave@nomad.inbox5.com>
parents:
14237
diff
changeset
|
128 %! old_state = rand ('state'); |
4506eade9f04
Use Matlab coding conventions for demos in plot/ directory.
Rik <octave@nomad.inbox5.com>
parents:
14237
diff
changeset
|
129 %! restore_state = onCleanup (@() rand ('state', old_state)); |
4506eade9f04
Use Matlab coding conventions for demos in plot/ directory.
Rik <octave@nomad.inbox5.com>
parents:
14237
diff
changeset
|
130 %! rand ('state', 10); |
9110
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
131 %! N = 10; |
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
132 %! x = 3 - 6 * rand (N, N); |
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
133 %! y = 3 - 6 * rand (N, N); |
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
134 %! z = peaks (x, y); |
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
135 %! tri = delaunay (x(:), y(:)); |
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
136 %! trisurf (tri, x(:), y(:), z(:)); |
12524
482cf3aad915
trisurf.m: Set default edgecolor as Matlab does. Add demos.
Ben Abbott <bpabbott@mac.com>
parents:
12187
diff
changeset
|
137 |
482cf3aad915
trisurf.m: Set default edgecolor as Matlab does. Add demos.
Ben Abbott <bpabbott@mac.com>
parents:
12187
diff
changeset
|
138 %!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
|
139 %! clf; |
14247
c4fa5e0b6193
test: Make surface demos reproducible by setting colormap to default at start of demo.
Rik <octave@nomad.inbox5.com>
parents:
14245
diff
changeset
|
140 %! colormap ('default'); |
12524
482cf3aad915
trisurf.m: Set default edgecolor as Matlab does. Add demos.
Ben Abbott <bpabbott@mac.com>
parents:
12187
diff
changeset
|
141 %! x = rand (100, 1); |
482cf3aad915
trisurf.m: Set default edgecolor as Matlab does. Add demos.
Ben Abbott <bpabbott@mac.com>
parents:
12187
diff
changeset
|
142 %! y = rand (100, 1); |
13141
e81ddf9cacd5
maint: untabify and remove trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
12792
diff
changeset
|
143 %! z = x.^2 + y.^2; |
e81ddf9cacd5
maint: untabify and remove trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
12792
diff
changeset
|
144 %! tri = delaunay (x, y); |
14001
5f0bb45e615c
doc: Update documentation for functions returning a graphics handle h (Bug #34761)
Rik <octave@nomad.inbox5.com>
parents:
13747
diff
changeset
|
145 %! trisurf (tri, x, y, z); |
12524
482cf3aad915
trisurf.m: Set default edgecolor as Matlab does. Add demos.
Ben Abbott <bpabbott@mac.com>
parents:
12187
diff
changeset
|
146 |
482cf3aad915
trisurf.m: Set default edgecolor as Matlab does. Add demos.
Ben Abbott <bpabbott@mac.com>
parents:
12187
diff
changeset
|
147 %!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
|
148 %! clf; |
14247
c4fa5e0b6193
test: Make surface demos reproducible by setting colormap to default at start of demo.
Rik <octave@nomad.inbox5.com>
parents:
14245
diff
changeset
|
149 %! colormap ('default'); |
12524
482cf3aad915
trisurf.m: Set default edgecolor as Matlab does. Add demos.
Ben Abbott <bpabbott@mac.com>
parents:
12187
diff
changeset
|
150 %! x = rand (100, 1); |
482cf3aad915
trisurf.m: Set default edgecolor as Matlab does. Add demos.
Ben Abbott <bpabbott@mac.com>
parents:
12187
diff
changeset
|
151 %! y = rand (100, 1); |
13141
e81ddf9cacd5
maint: untabify and remove trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
12792
diff
changeset
|
152 %! z = x.^2 + y.^2; |
e81ddf9cacd5
maint: untabify and remove trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
12792
diff
changeset
|
153 %! tri = delaunay (x, y); |
14245
4506eade9f04
Use Matlab coding conventions for demos in plot/ directory.
Rik <octave@nomad.inbox5.com>
parents:
14237
diff
changeset
|
154 %! trisurf (tri, x, y, z, 'facecolor', 'interp'); |
12524
482cf3aad915
trisurf.m: Set default edgecolor as Matlab does. Add demos.
Ben Abbott <bpabbott@mac.com>
parents:
12187
diff
changeset
|
155 |
482cf3aad915
trisurf.m: Set default edgecolor as Matlab does. Add demos.
Ben Abbott <bpabbott@mac.com>
parents:
12187
diff
changeset
|
156 %!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
|
157 %! clf; |
14247
c4fa5e0b6193
test: Make surface demos reproducible by setting colormap to default at start of demo.
Rik <octave@nomad.inbox5.com>
parents:
14245
diff
changeset
|
158 %! colormap ('default'); |
12524
482cf3aad915
trisurf.m: Set default edgecolor as Matlab does. Add demos.
Ben Abbott <bpabbott@mac.com>
parents:
12187
diff
changeset
|
159 %! x = rand (100, 1); |
482cf3aad915
trisurf.m: Set default edgecolor as Matlab does. Add demos.
Ben Abbott <bpabbott@mac.com>
parents:
12187
diff
changeset
|
160 %! y = rand (100, 1); |
13141
e81ddf9cacd5
maint: untabify and remove trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
12792
diff
changeset
|
161 %! z = x.^2 + y.^2; |
e81ddf9cacd5
maint: untabify and remove trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
12792
diff
changeset
|
162 %! tri = delaunay (x, y); |
14245
4506eade9f04
Use Matlab coding conventions for demos in plot/ directory.
Rik <octave@nomad.inbox5.com>
parents:
14237
diff
changeset
|
163 %! trisurf (tri, x, y, z, 'facecolor', 'interp', 'edgecolor', 'k'); |
12524
482cf3aad915
trisurf.m: Set default edgecolor as Matlab does. Add demos.
Ben Abbott <bpabbott@mac.com>
parents:
12187
diff
changeset
|
164 |
17440 | 165 %% Test input validation |
166 %!error trisurf () | |
167 %!error trisurf (1) | |
168 %!error trisurf (1,2) | |
169 %!error trisurf (1,2,3) | |
170 %!error <C must have 'numel \(Z\)' elements> trisurf (1,2,3,4,[5 6]) | |
171 %!error <C must have 'numel \(Z\)' elements> trisurf (1,2,3,4,[5 6]') | |
172 %!error <TrueColor C matrix must> trisurf ([1;1],[2;2],[3;3],[4;4],zeros(3,3)) | |
173 %!error <TrueColor C matrix must> trisurf ([1;1],[2;2],[3;3],[4;4],zeros(2,2)) | |
174 |