annotate scripts/plot/trimesh.m @ 14092:22c50cbad2ce stable

Add clf() to all plot demos. * axis.m, compass.m, contour3.m, contourf.m, cylinder.m, ellipsoid.m, errorbar.m, ezcontour.m, ezcontourf.m, ezmesh.m, ezmeshc.m, ezplot.m, ezplot3.m, ezpolar.m, ezsurf.m, ezsurfc.m, feather.m, fplot.m, loglogerr.m, pcolor.m, pie.m, pie3.m, plot3.m, plotmatrix.m, quiver.m, quiver3.m, refreshdata.m, ribbon.m, rose.m, scatter3.m, semilogx.m, semilogxerr.m, semilogy.m, semilogyerr.m, shading.m, sombrero.m, stairs.m, stem.m, stem3.m, surf.m, surfc.m, surfl.m, surfnorm.m, trimesh.m, triplot.m, trisurf.m, uimenu.m: Add clf() to the beginning of each demo to ensure pre-existing graphics objects don't interfere with the demo.
author Ben Abbott <bpabbott@mac.com>
date Wed, 21 Dec 2011 21:19:48 -0500
parents 5f0bb45e615c
children 72c96de7a403
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
11523
fd0a3ac60b0e update copyright notices
John W. Eaton <jwe@octave.org>
parents: 10793
diff changeset
1 ## Copyright (C) 2007-2011 David Bateman
6823
9fddcc586065 [project @ 2007-08-24 08:27:27 by dbateman]
dbateman
parents:
diff changeset
2 ##
9fddcc586065 [project @ 2007-08-24 08:27:27 by dbateman]
dbateman
parents:
diff changeset
3 ## This file is part of Octave.
9fddcc586065 [project @ 2007-08-24 08:27:27 by dbateman]
dbateman
parents:
diff changeset
4 ##
9fddcc586065 [project @ 2007-08-24 08:27:27 by dbateman]
dbateman
parents:
diff changeset
5 ## Octave is free software; you can redistribute it and/or modify it
9fddcc586065 [project @ 2007-08-24 08:27:27 by dbateman]
dbateman
parents:
diff changeset
6 ## under the terms of the GNU General Public License as published by
7016
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6832
diff changeset
7 ## the Free Software Foundation; either version 3 of the License, or (at
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6832
diff changeset
8 ## your option) any later version.
6823
9fddcc586065 [project @ 2007-08-24 08:27:27 by dbateman]
dbateman
parents:
diff changeset
9 ##
9fddcc586065 [project @ 2007-08-24 08:27:27 by dbateman]
dbateman
parents:
diff changeset
10 ## Octave is distributed in the hope that it will be useful, but
9fddcc586065 [project @ 2007-08-24 08:27:27 by dbateman]
dbateman
parents:
diff changeset
11 ## WITHOUT ANY WARRANTY; without even the implied warranty of
9fddcc586065 [project @ 2007-08-24 08:27:27 by dbateman]
dbateman
parents:
diff changeset
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
9fddcc586065 [project @ 2007-08-24 08:27:27 by dbateman]
dbateman
parents:
diff changeset
13 ## General Public License for more details.
9fddcc586065 [project @ 2007-08-24 08:27:27 by dbateman]
dbateman
parents:
diff changeset
14 ##
9fddcc586065 [project @ 2007-08-24 08:27:27 by dbateman]
dbateman
parents:
diff changeset
15 ## You should have received a copy of the GNU General Public License
7016
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6832
diff changeset
16 ## along with Octave; see the file COPYING. If not, see
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6832
diff changeset
17 ## <http://www.gnu.org/licenses/>.
6823
9fddcc586065 [project @ 2007-08-24 08:27:27 by dbateman]
dbateman
parents:
diff changeset
18
9fddcc586065 [project @ 2007-08-24 08:27:27 by dbateman]
dbateman
parents:
diff changeset
19 ## -*- texinfo -*-
10793
be55736a0783 Grammarcheck the documentation from m-files.
Rik <octave@nomad.inbox5.com>
parents: 10549
diff changeset
20 ## @deftypefn {Function File} {} trimesh (@var{tri}, @var{x}, @var{y}, @var{z})
7650
eb7bdde776f2 Texinfo fixes
John W. Eaton <jwe@octave.org>
parents: 7017
diff changeset
21 ## @deftypefnx {Function File} {@var{h} =} trimesh (@dots{})
10793
be55736a0783 Grammarcheck the documentation from m-files.
Rik <octave@nomad.inbox5.com>
parents: 10549
diff changeset
22 ## Plot a triangular mesh in 3D@. The variable @var{tri} is the triangular
11587
c792872f8942 all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
23 ## meshing of the points @code{(@var{x}, @var{y})} which is returned
c792872f8942 all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
24 ## from @code{delaunay}. The variable @var{z} is value at the point
14001
5f0bb45e615c doc: Update documentation for functions returning a graphics handle h (Bug #34761)
Rik <octave@nomad.inbox5.com>
parents: 13747
diff changeset
25 ## @code{(@var{x}, @var{y})}.
5f0bb45e615c doc: Update documentation for functions returning a graphics handle h (Bug #34761)
Rik <octave@nomad.inbox5.com>
parents: 13747
diff changeset
26 ##
5f0bb45e615c doc: Update documentation for functions returning a graphics handle h (Bug #34761)
Rik <octave@nomad.inbox5.com>
parents: 13747
diff changeset
27 ## The optional return value @var{h} is a graphics handle to the created plot.
12187
87926ee23581 Add undocumented function trisurf to manual.
Rik <octave@nomad.inbox5.com>
parents: 11587
diff changeset
28 ## @seealso{triplot, trisurf, delaunay3}
6823
9fddcc586065 [project @ 2007-08-24 08:27:27 by dbateman]
dbateman
parents:
diff changeset
29 ## @end deftypefn
9fddcc586065 [project @ 2007-08-24 08:27:27 by dbateman]
dbateman
parents:
diff changeset
30
9fddcc586065 [project @ 2007-08-24 08:27:27 by dbateman]
dbateman
parents:
diff changeset
31 function h = trimesh (tri, x, y, z, varargin)
9fddcc586065 [project @ 2007-08-24 08:27:27 by dbateman]
dbateman
parents:
diff changeset
32
9fddcc586065 [project @ 2007-08-24 08:27:27 by dbateman]
dbateman
parents:
diff changeset
33 if (nargin < 3)
6826
8618f29520c6 [project @ 2007-08-24 16:02:07 by jwe]
jwe
parents: 6823
diff changeset
34 print_usage ();
6823
9fddcc586065 [project @ 2007-08-24 08:27:27 by dbateman]
dbateman
parents:
diff changeset
35 endif
9fddcc586065 [project @ 2007-08-24 08:27:27 by dbateman]
dbateman
parents:
diff changeset
36
9fddcc586065 [project @ 2007-08-24 08:27:27 by dbateman]
dbateman
parents:
diff changeset
37 if (nargin == 3)
9fddcc586065 [project @ 2007-08-24 08:27:27 by dbateman]
dbateman
parents:
diff changeset
38 triplot (tri, x, y);
9fddcc586065 [project @ 2007-08-24 08:27:27 by dbateman]
dbateman
parents:
diff changeset
39 elseif (ischar (z))
9fddcc586065 [project @ 2007-08-24 08:27:27 by dbateman]
dbateman
parents:
diff changeset
40 triplot (tri, x, y, z, varargin{:});
9fddcc586065 [project @ 2007-08-24 08:27:27 by dbateman]
dbateman
parents:
diff changeset
41 else
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: 9051
diff changeset
42 newplot ();
13747
e8564e8b0043 Restore random number state after %!demos or %!tests
Rik <octave@nomad.inbox5.com>
parents: 12792
diff changeset
43 handle = patch ("Vertices", [x(:), y(:), z(:)], "Faces", tri,
e8564e8b0043 Restore random number state after %!demos or %!tests
Rik <octave@nomad.inbox5.com>
parents: 12792
diff changeset
44 "FaceColor", "none", "EdgeColor", __next_line_color__(),
e8564e8b0043 Restore random number state after %!demos or %!tests
Rik <octave@nomad.inbox5.com>
parents: 12792
diff changeset
45 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: 9051
diff changeset
46 if (! ishold ())
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: 9051
diff changeset
47 set (gca(), "view", [-37.5, 30],
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 9245
diff changeset
48 "xgrid", "on", "ygrid", "on", "zgrid", "on");
6823
9fddcc586065 [project @ 2007-08-24 08:27:27 by dbateman]
dbateman
parents:
diff changeset
49 endif
13747
e8564e8b0043 Restore random number state after %!demos or %!tests
Rik <octave@nomad.inbox5.com>
parents: 12792
diff changeset
50 if (nargout > 0)
e8564e8b0043 Restore random number state after %!demos or %!tests
Rik <octave@nomad.inbox5.com>
parents: 12792
diff changeset
51 h = handle;
e8564e8b0043 Restore random number state after %!demos or %!tests
Rik <octave@nomad.inbox5.com>
parents: 12792
diff changeset
52 endif
6823
9fddcc586065 [project @ 2007-08-24 08:27:27 by dbateman]
dbateman
parents:
diff changeset
53 endif
13747
e8564e8b0043 Restore random number state after %!demos or %!tests
Rik <octave@nomad.inbox5.com>
parents: 12792
diff changeset
54
6823
9fddcc586065 [project @ 2007-08-24 08:27:27 by dbateman]
dbateman
parents:
diff changeset
55 endfunction
9fddcc586065 [project @ 2007-08-24 08:27:27 by dbateman]
dbateman
parents:
diff changeset
56
13747
e8564e8b0043 Restore random number state after %!demos or %!tests
Rik <octave@nomad.inbox5.com>
parents: 12792
diff changeset
57
6823
9fddcc586065 [project @ 2007-08-24 08:27:27 by dbateman]
dbateman
parents:
diff changeset
58 %!demo
14092
22c50cbad2ce Add clf() to all plot demos.
Ben Abbott <bpabbott@mac.com>
parents: 14001
diff changeset
59 %! clf
13747
e8564e8b0043 Restore random number state after %!demos or %!tests
Rik <octave@nomad.inbox5.com>
parents: 12792
diff changeset
60 %! old_state = rand ("state");
e8564e8b0043 Restore random number state after %!demos or %!tests
Rik <octave@nomad.inbox5.com>
parents: 12792
diff changeset
61 %! restore_state = onCleanup (@() rand ("state", old_state));
e8564e8b0043 Restore random number state after %!demos or %!tests
Rik <octave@nomad.inbox5.com>
parents: 12792
diff changeset
62 %! 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: 9051
diff changeset
63 %! 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: 9051
diff changeset
64 %! 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: 9051
diff changeset
65 %! y = 3 - 6 * rand (N, N);
6823
9fddcc586065 [project @ 2007-08-24 08:27:27 by dbateman]
dbateman
parents:
diff changeset
66 %! z = peaks (x, y);
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: 9051
diff changeset
67 %! 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: 9051
diff changeset
68 %! trimesh (tri, x(:), y(:), z(:));
13747
e8564e8b0043 Restore random number state after %!demos or %!tests
Rik <octave@nomad.inbox5.com>
parents: 12792
diff changeset
69