Mercurial > hg > octave-lyh
annotate scripts/plot/triplot.m @ 13977:08ae07e40d4f
Only run uimenu tests if FLTK toolkit is available (Bug #34908)
* graphics_toolkit.m: Correct @deftypefn to @deftypefnx for Texinfo to build
* allchild.m: Eliminate unnecessary for loop. Only run test if FLTK toolkit
is available.
* findall.m, uimenu.m: Only run test if FLTK toolkit is available.
author | Rik <octave@nomad.inbox5.com> |
---|---|
date | Fri, 02 Dec 2011 14:48:45 -0800 |
parents | e8564e8b0043 |
children | 5f0bb45e615c |
rev | line source |
---|---|
11523 | 1 ## Copyright (C) 2007-2011 David Bateman |
6823 | 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 | |
7016 | 7 ## the Free Software Foundation; either version 3 of the License, or (at |
8 ## your option) any later version. | |
6823 | 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 | |
7016 | 16 ## along with Octave; see the file COPYING. If not, see |
17 ## <http://www.gnu.org/licenses/>. | |
6823 | 18 |
19 ## -*- texinfo -*- | |
10793
be55736a0783
Grammarcheck the documentation from m-files.
Rik <octave@nomad.inbox5.com>
parents:
10549
diff
changeset
|
20 ## @deftypefn {Function File} {} triplot (@var{tri}, @var{x}, @var{y}) |
6823 | 21 ## @deftypefnx {Function File} {} triplot (@var{tri}, @var{x}, @var{y}, @var{linespec}) |
7650 | 22 ## @deftypefnx {Function File} {@var{h} =} triplot (@dots{}) |
10793
be55736a0783
Grammarcheck the documentation from m-files.
Rik <octave@nomad.inbox5.com>
parents:
10549
diff
changeset
|
23 ## Plot a triangular mesh in 2D@. The variable @var{tri} is the triangular |
6823 | 24 ## meshing of the points @code{(@var{x}, @var{y})} which is returned from |
13747
e8564e8b0043
Restore random number state after %!demos or %!tests
Rik <octave@nomad.inbox5.com>
parents:
12792
diff
changeset
|
25 ## @code{delaunay}. If given, @var{linespec} determines the properties |
9051
1bf0ce0930be
Grammar check TexInfo in all .m files
Rik <rdrider0-list@yahoo.com>
parents:
8920
diff
changeset
|
26 ## to use for the lines. The output argument @var{h} is the graphic handle |
12187
87926ee23581
Add undocumented function trisurf to manual.
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
27 ## of the plot. |
87926ee23581
Add undocumented function trisurf to manual.
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
28 ## @seealso{plot, trimesh, trisurf, delaunay} |
6823 | 29 ## @end deftypefn |
30 | |
31 function h = triplot (tri, x, y, varargin) | |
32 | |
33 if (nargin < 3) | |
6826 | 34 print_usage (); |
6823 | 35 endif |
36 | |
6826 | 37 idx = tri(:, [1, 2, 3, 1]).'; |
13747
e8564e8b0043
Restore random number state after %!demos or %!tests
Rik <octave@nomad.inbox5.com>
parents:
12792
diff
changeset
|
38 nt = rows (tri); |
e8564e8b0043
Restore random number state after %!demos or %!tests
Rik <octave@nomad.inbox5.com>
parents:
12792
diff
changeset
|
39 handle = plot ([x(idx); NaN(1, nt)](:), |
e8564e8b0043
Restore random number state after %!demos or %!tests
Rik <octave@nomad.inbox5.com>
parents:
12792
diff
changeset
|
40 [y(idx); NaN(1, nt)](:), varargin{:}); |
e8564e8b0043
Restore random number state after %!demos or %!tests
Rik <octave@nomad.inbox5.com>
parents:
12792
diff
changeset
|
41 |
6823 | 42 if (nargout > 0) |
13747
e8564e8b0043
Restore random number state after %!demos or %!tests
Rik <octave@nomad.inbox5.com>
parents:
12792
diff
changeset
|
43 h = handle; |
6823 | 44 endif |
13747
e8564e8b0043
Restore random number state after %!demos or %!tests
Rik <octave@nomad.inbox5.com>
parents:
12792
diff
changeset
|
45 |
6823 | 46 endfunction |
47 | |
13747
e8564e8b0043
Restore random number state after %!demos or %!tests
Rik <octave@nomad.inbox5.com>
parents:
12792
diff
changeset
|
48 |
6823 | 49 %!demo |
13747
e8564e8b0043
Restore random number state after %!demos or %!tests
Rik <octave@nomad.inbox5.com>
parents:
12792
diff
changeset
|
50 %! old_state = rand ("state"); |
e8564e8b0043
Restore random number state after %!demos or %!tests
Rik <octave@nomad.inbox5.com>
parents:
12792
diff
changeset
|
51 %! 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
|
52 %! rand ("state", 2); |
e8564e8b0043
Restore random number state after %!demos or %!tests
Rik <octave@nomad.inbox5.com>
parents:
12792
diff
changeset
|
53 %! N = 20; |
e8564e8b0043
Restore random number state after %!demos or %!tests
Rik <octave@nomad.inbox5.com>
parents:
12792
diff
changeset
|
54 %! x = rand (N, 1); |
e8564e8b0043
Restore random number state after %!demos or %!tests
Rik <octave@nomad.inbox5.com>
parents:
12792
diff
changeset
|
55 %! y = rand (N, 1); |
6823 | 56 %! tri = delaunay (x, y); |
57 %! triplot (tri, x, y); | |
13747
e8564e8b0043
Restore random number state after %!demos or %!tests
Rik <octave@nomad.inbox5.com>
parents:
12792
diff
changeset
|
58 |