Mercurial > hg > octave-lyh
annotate scripts/plot/trisurf.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 | 0fa126e9944e |
rev | line source |
---|---|
14138
72c96de7a403
maint: update copyright notices for 2012
John W. Eaton <jwe@octave.org>
parents:
14108
diff
changeset
|
1 ## Copyright (C) 2007-2012 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 -*- |
17126
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{}) |
17126
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 ## |
17126
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} |
eaab03308c0b
doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents:
17021
diff
changeset
|
40 ## by supplying a color matrix, @var{c}. |
eaab03308c0b
doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents:
17021
diff
changeset
|
41 ## |
eaab03308c0b
doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents:
17021
diff
changeset
|
42 ## 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
|
43 ## |
eaab03308c0b
doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents:
17021
diff
changeset
|
44 ## 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
|
45 ## object. |
eaab03308c0b
doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents:
17021
diff
changeset
|
46 ## @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
|
47 ## @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
|
48 |
13747
e8564e8b0043
Restore random number state after %!demos or %!tests
Rik <octave@nomad.inbox5.com>
parents:
13141
diff
changeset
|
49 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
|
50 |
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
|
51 if (nargin < 3) |
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 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
|
53 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
|
54 |
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 if (nargin == 3) |
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 triplot (tri, 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
|
57 elseif (ischar (z)) |
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
|
58 triplot (tri, x, y, z, varargin{:}); |
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
|
59 else |
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
|
60 if (nargin > 4 && isnumeric (varargin{1})) |
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
|
61 c = varargin{1}; |
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
|
62 varargin(1) = []; |
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
|
63 else |
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
|
64 c = z; |
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
|
65 endif |
12524
482cf3aad915
trisurf.m: Set default edgecolor as Matlab does. Add demos.
Ben Abbott <bpabbott@mac.com>
parents:
12187
diff
changeset
|
66 if (! any (strcmpi (varargin, "FaceColor"))) |
482cf3aad915
trisurf.m: Set default edgecolor as Matlab does. Add demos.
Ben Abbott <bpabbott@mac.com>
parents:
12187
diff
changeset
|
67 nfc = numel (varargin) + 1; |
482cf3aad915
trisurf.m: Set default edgecolor as Matlab does. Add demos.
Ben Abbott <bpabbott@mac.com>
parents:
12187
diff
changeset
|
68 varargin(nfc+(0:1)) = {"FaceColor", "flat"}; |
482cf3aad915
trisurf.m: Set default edgecolor as Matlab does. Add demos.
Ben Abbott <bpabbott@mac.com>
parents:
12187
diff
changeset
|
69 else |
482cf3aad915
trisurf.m: Set default edgecolor as Matlab does. Add demos.
Ben Abbott <bpabbott@mac.com>
parents:
12187
diff
changeset
|
70 nfc = find (any (strcmpi (varargin, "FaceColor")), 1); |
482cf3aad915
trisurf.m: Set default edgecolor as Matlab does. Add demos.
Ben Abbott <bpabbott@mac.com>
parents:
12187
diff
changeset
|
71 endif |
482cf3aad915
trisurf.m: Set default edgecolor as Matlab does. Add demos.
Ben Abbott <bpabbott@mac.com>
parents:
12187
diff
changeset
|
72 if (! any (strcmpi (varargin, "EdgeColor")) |
482cf3aad915
trisurf.m: Set default edgecolor as Matlab does. Add demos.
Ben Abbott <bpabbott@mac.com>
parents:
12187
diff
changeset
|
73 && strcmpi (varargin{nfc+1}, "interp")) |
482cf3aad915
trisurf.m: Set default edgecolor as Matlab does. Add demos.
Ben Abbott <bpabbott@mac.com>
parents:
12187
diff
changeset
|
74 varargin(end+(1:2)) = {"EdgeColor", "none"}; |
482cf3aad915
trisurf.m: Set default edgecolor as Matlab does. Add demos.
Ben Abbott <bpabbott@mac.com>
parents:
12187
diff
changeset
|
75 endif |
17130
26589abbc78d
Don't pass axis handle unnecessarily from high level to low level plot functions.
Rik <rik@octave.org>
parents:
17126
diff
changeset
|
76 hax = newplot (); |
26589abbc78d
Don't pass axis handle unnecessarily from high level to low level plot functions.
Rik <rik@octave.org>
parents:
17126
diff
changeset
|
77 htmp = patch ("Faces", tri, "Vertices", [x(:), y(:), z(:)], |
26589abbc78d
Don't pass axis handle unnecessarily from high level to low level plot functions.
Rik <rik@octave.org>
parents:
17126
diff
changeset
|
78 "FaceVertexCData", reshape (c, numel (c), 1), |
26589abbc78d
Don't pass axis handle unnecessarily from high level to low level plot functions.
Rik <rik@octave.org>
parents:
17126
diff
changeset
|
79 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
|
80 if (nargout > 0) |
17130
26589abbc78d
Don't pass axis handle unnecessarily from high level to low level plot functions.
Rik <rik@octave.org>
parents:
17126
diff
changeset
|
81 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
|
82 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
|
83 |
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
|
84 if (! ishold ()) |
17130
26589abbc78d
Don't pass axis handle unnecessarily from high level to low level plot functions.
Rik <rik@octave.org>
parents:
17126
diff
changeset
|
85 set (hax, "view", [-37.5, 30], |
26589abbc78d
Don't pass axis handle unnecessarily from high level to low level plot functions.
Rik <rik@octave.org>
parents:
17126
diff
changeset
|
86 "xgrid", "on", "ygrid", "on", "zgrid", "on"); |
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
|
87 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
|
88 endif |
13747
e8564e8b0043
Restore random number state after %!demos or %!tests
Rik <octave@nomad.inbox5.com>
parents:
13141
diff
changeset
|
89 |
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
|
90 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
|
91 |
14237
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
92 |
14108 | 93 %!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
|
94 %! 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
|
95 %! colormap ('default'); |
14108 | 96 %! N = 31; |
97 %! [x, y] = meshgrid (1:N); | |
17021
154899fa42e3
trisurf.m: Fix incorrect delaunay syntax in %!demo blocks
Rik <rik@octave.org>
parents:
14846
diff
changeset
|
98 %! tri = delaunay (x(:), y(:)); |
14108 | 99 %! z = peaks (N); |
14245
4506eade9f04
Use Matlab coding conventions for demos in plot/ directory.
Rik <octave@nomad.inbox5.com>
parents:
14237
diff
changeset
|
100 %! 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
|
101 %! 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
|
102 %! zlim auto; |
14245
4506eade9f04
Use Matlab coding conventions for demos in plot/ directory.
Rik <octave@nomad.inbox5.com>
parents:
14237
diff
changeset
|
103 %! title (sprintf ('facecolor = %s', get (h, 'facecolor'))); |
14108 | 104 |
105 %!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
|
106 %! 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
|
107 %! colormap ('default'); |
14108 | 108 %! N = 31; |
109 %! [x, y] = meshgrid (1:N); | |
17021
154899fa42e3
trisurf.m: Fix incorrect delaunay syntax in %!demo blocks
Rik <rik@octave.org>
parents:
14846
diff
changeset
|
110 %! tri = delaunay (x(:), y(:)); |
14108 | 111 %! z = peaks (N); |
14245
4506eade9f04
Use Matlab coding conventions for demos in plot/ directory.
Rik <octave@nomad.inbox5.com>
parents:
14237
diff
changeset
|
112 %! 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
|
113 %! 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
|
114 %! zlim auto; |
14245
4506eade9f04
Use Matlab coding conventions for demos in plot/ directory.
Rik <octave@nomad.inbox5.com>
parents:
14237
diff
changeset
|
115 %! 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
|
116 |
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
|
117 %!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
|
118 %! 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
|
119 %! colormap ('default'); |
14245
4506eade9f04
Use Matlab coding conventions for demos in plot/ directory.
Rik <octave@nomad.inbox5.com>
parents:
14237
diff
changeset
|
120 %! old_state = rand ('state'); |
4506eade9f04
Use Matlab coding conventions for demos in plot/ directory.
Rik <octave@nomad.inbox5.com>
parents:
14237
diff
changeset
|
121 %! 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
|
122 %! 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
|
123 %! 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
|
124 %! 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
|
125 %! 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
|
126 %! 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
|
127 %! 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
|
128 %! 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
|
129 |
482cf3aad915
trisurf.m: Set default edgecolor as Matlab does. Add demos.
Ben Abbott <bpabbott@mac.com>
parents:
12187
diff
changeset
|
130 %!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
|
131 %! 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
|
132 %! colormap ('default'); |
12524
482cf3aad915
trisurf.m: Set default edgecolor as Matlab does. Add demos.
Ben Abbott <bpabbott@mac.com>
parents:
12187
diff
changeset
|
133 %! x = rand (100, 1); |
482cf3aad915
trisurf.m: Set default edgecolor as Matlab does. Add demos.
Ben Abbott <bpabbott@mac.com>
parents:
12187
diff
changeset
|
134 %! 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
|
135 %! 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
|
136 %! 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
|
137 %! 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
|
138 |
482cf3aad915
trisurf.m: Set default edgecolor as Matlab does. Add demos.
Ben Abbott <bpabbott@mac.com>
parents:
12187
diff
changeset
|
139 %!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
|
140 %! 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
|
141 %! colormap ('default'); |
12524
482cf3aad915
trisurf.m: Set default edgecolor as Matlab does. Add demos.
Ben Abbott <bpabbott@mac.com>
parents:
12187
diff
changeset
|
142 %! x = rand (100, 1); |
482cf3aad915
trisurf.m: Set default edgecolor as Matlab does. Add demos.
Ben Abbott <bpabbott@mac.com>
parents:
12187
diff
changeset
|
143 %! 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
|
144 %! 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
|
145 %! tri = delaunay (x, y); |
14245
4506eade9f04
Use Matlab coding conventions for demos in plot/ directory.
Rik <octave@nomad.inbox5.com>
parents:
14237
diff
changeset
|
146 %! 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
|
147 |
482cf3aad915
trisurf.m: Set default edgecolor as Matlab does. Add demos.
Ben Abbott <bpabbott@mac.com>
parents:
12187
diff
changeset
|
148 %!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
|
149 %! 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
|
150 %! colormap ('default'); |
12524
482cf3aad915
trisurf.m: Set default edgecolor as Matlab does. Add demos.
Ben Abbott <bpabbott@mac.com>
parents:
12187
diff
changeset
|
151 %! x = rand (100, 1); |
482cf3aad915
trisurf.m: Set default edgecolor as Matlab does. Add demos.
Ben Abbott <bpabbott@mac.com>
parents:
12187
diff
changeset
|
152 %! 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
|
153 %! 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
|
154 %! tri = delaunay (x, y); |
14245
4506eade9f04
Use Matlab coding conventions for demos in plot/ directory.
Rik <octave@nomad.inbox5.com>
parents:
14237
diff
changeset
|
155 %! 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
|
156 |