annotate scripts/plot/patch.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 eaab03308c0b
children df4c4b7708a4
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
14138
72c96de7a403 maint: update copyright notices for 2012
John W. Eaton <jwe@octave.org>
parents: 14001
diff changeset
1 ## Copyright (C) 2005-2012 John W. Eaton
6807
0089a504fdd6 [project @ 2007-08-10 17:34:59 by jwe]
jwe
parents:
diff changeset
2 ##
0089a504fdd6 [project @ 2007-08-10 17:34:59 by jwe]
jwe
parents:
diff changeset
3 ## This file is part of Octave.
0089a504fdd6 [project @ 2007-08-10 17:34:59 by jwe]
jwe
parents:
diff changeset
4 ##
0089a504fdd6 [project @ 2007-08-10 17:34:59 by jwe]
jwe
parents:
diff changeset
5 ## Octave is free software; you can redistribute it and/or modify it
0089a504fdd6 [project @ 2007-08-10 17:34:59 by jwe]
jwe
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: 6988
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: 6988
diff changeset
8 ## your option) any later version.
6807
0089a504fdd6 [project @ 2007-08-10 17:34:59 by jwe]
jwe
parents:
diff changeset
9 ##
0089a504fdd6 [project @ 2007-08-10 17:34:59 by jwe]
jwe
parents:
diff changeset
10 ## Octave is distributed in the hope that it will be useful, but
0089a504fdd6 [project @ 2007-08-10 17:34:59 by jwe]
jwe
parents:
diff changeset
11 ## WITHOUT ANY WARRANTY; without even the implied warranty of
0089a504fdd6 [project @ 2007-08-10 17:34:59 by jwe]
jwe
parents:
diff changeset
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
0089a504fdd6 [project @ 2007-08-10 17:34:59 by jwe]
jwe
parents:
diff changeset
13 ## General Public License for more details.
0089a504fdd6 [project @ 2007-08-10 17:34:59 by jwe]
jwe
parents:
diff changeset
14 ##
0089a504fdd6 [project @ 2007-08-10 17:34:59 by jwe]
jwe
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: 6988
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: 6988
diff changeset
17 ## <http://www.gnu.org/licenses/>.
6807
0089a504fdd6 [project @ 2007-08-10 17:34:59 by jwe]
jwe
parents:
diff changeset
18
0089a504fdd6 [project @ 2007-08-10 17:34:59 by jwe]
jwe
parents:
diff changeset
19 ## -*- texinfo -*-
10793
be55736a0783 Grammarcheck the documentation from m-files.
Rik <octave@nomad.inbox5.com>
parents: 9110
diff changeset
20 ## @deftypefn {Function File} {} patch ()
6807
0089a504fdd6 [project @ 2007-08-10 17:34:59 by jwe]
jwe
parents:
diff changeset
21 ## @deftypefnx {Function File} {} patch (@var{x}, @var{y}, @var{c})
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: 8920
diff changeset
22 ## @deftypefnx {Function File} {} patch (@var{x}, @var{y}, @var{z}, @var{c})
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: 8920
diff changeset
23 ## @deftypefnx {Function File} {} patch (@var{fv})
17126
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 17039
diff changeset
24 ## @deftypefnx {Function File} {} patch ("Faces", @var{faces}, "Vertices", @var{verts}, @dots{})
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 17039
diff changeset
25 ## @deftypefnx {Function File} {} patch (@dots{}, @var{prop}, @var{val}, @dots{})
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 17039
diff changeset
26 ## @deftypefnx {Function File} {} patch (@var{hax}, @dots{})
7650
eb7bdde776f2 Texinfo fixes
John W. Eaton <jwe@octave.org>
parents: 7216
diff changeset
27 ## @deftypefnx {Function File} {@var{h} =} patch (@dots{})
17126
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 17039
diff changeset
28 ## Create patch object in the current axes with vertices at locations
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 17039
diff changeset
29 ## (@var{x}, @var{y}) and of color @var{c}.
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 17039
diff changeset
30 ##
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 17039
diff changeset
31 ## If the vertices are matrices of size @nospell{MxN} then each polygon patch
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 17039
diff changeset
32 ## has M vertices and a total of N polygons will be created. If some polygons
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 17039
diff changeset
33 ## do not have M vertices use NaN to represent "no vertex". If the @var{z}
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 17039
diff changeset
34 ## input is present then 3-D patches will be created.
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 17039
diff changeset
35 ##
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 17039
diff changeset
36 ## The color argument @var{c} can take many forms. To create polygons
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 17039
diff changeset
37 ## which all share a single color use a string value (e.g., "r" for
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 17039
diff changeset
38 ## red), a scalar value which is scaled by @code{caxis} and indexed into the
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 17039
diff changeset
39 ## current colormap, or a 3-element RGB vector with the precise TrueColor.
6895
76e3d985ae56 [project @ 2007-09-13 18:22:38 by jwe]
jwe
parents: 6807
diff changeset
40 ##
17126
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 17039
diff changeset
41 ## If @var{c} is a vector of length N then the ith polygon will have a color
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 17039
diff changeset
42 ## determined by scaling entry @var{c}(i) according to @code{caxis} and then
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 17039
diff changeset
43 ## indexing into the current colormap. More complicated coloring situations
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 17039
diff changeset
44 ## require directly manipulating patch property/value pairs.
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: 8920
diff changeset
45 ##
17126
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 17039
diff changeset
46 ## Instead of specifying polygons by matrices @var{x} and @var{y}, it is
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 17039
diff changeset
47 ## possible to present a unique list of vertices and then a list of polygon
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 17039
diff changeset
48 ## faces created from those vertices. In this case the "Vertices" matrix will
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 17039
diff changeset
49 ## be an @nospell{Nx2} (2-D patch) or @nospell{Nx3} (3-D path). The
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 17039
diff changeset
50 ## @nospell{MxN} "Faces" matrix describes M polygons having N vertices---each
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 17039
diff changeset
51 ## row describes a single polygon and each column entry is an index into the
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 17039
diff changeset
52 ## "Vertices" matrix to identify a vertex. The patch object can be created by
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 17039
diff changeset
53 ## directly passing the property/value pairs "Vertices"/@var{verts},
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 17039
diff changeset
54 ## "Faces"/@var{faces} as inputs.
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 17039
diff changeset
55 ##
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 17039
diff changeset
56 ## A third input form is to create a structure @var{fv} with the fields
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 17039
diff changeset
57 ## "vertices", "faces", and optionally "facevertexcdata".
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 17039
diff changeset
58 ##
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 17039
diff changeset
59 ## 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: 17039
diff changeset
60 ## 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: 13811
diff changeset
61 ##
5f0bb45e615c doc: Update documentation for functions returning a graphics handle h (Bug #34761)
Rik <octave@nomad.inbox5.com>
parents: 13811
diff changeset
62 ## The optional return value @var{h} is a graphics handle to the created patch
5f0bb45e615c doc: Update documentation for functions returning a graphics handle h (Bug #34761)
Rik <octave@nomad.inbox5.com>
parents: 13811
diff changeset
63 ## object.
17126
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 17039
diff changeset
64 ##
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 17039
diff changeset
65 ## Implementation Note: Patches are highly configurable objects. To truly
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 17039
diff changeset
66 ## customize them requires setting patch properties directly. Useful patch
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 17039
diff changeset
67 ## properties are: "cdata", "edgecolor", "facecolor", "faces",
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 17039
diff changeset
68 ## "facevertexcdata",
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 17039
diff changeset
69 ##
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 17039
diff changeset
70 ## @seealso{fill, get, set}
6807
0089a504fdd6 [project @ 2007-08-10 17:34:59 by jwe]
jwe
parents:
diff changeset
71 ## @end deftypefn
0089a504fdd6 [project @ 2007-08-10 17:34:59 by jwe]
jwe
parents:
diff changeset
72
0089a504fdd6 [project @ 2007-08-10 17:34:59 by jwe]
jwe
parents:
diff changeset
73 ## Author: jwe
0089a504fdd6 [project @ 2007-08-10 17:34:59 by jwe]
jwe
parents:
diff changeset
74
17126
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 17039
diff changeset
75 function h = patch (varargin)
6807
0089a504fdd6 [project @ 2007-08-10 17:34:59 by jwe]
jwe
parents:
diff changeset
76
17039
854cfc72c64f patch.m: Update to use new __plt_get_axis_arg__.
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 14363
diff changeset
77 [hax, varargin] = __plt_get_axis_arg__ ("patch", varargin{:});
854cfc72c64f patch.m: Update to use new __plt_get_axis_arg__.
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 14363
diff changeset
78
854cfc72c64f patch.m: Update to use new __plt_get_axis_arg__.
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 14363
diff changeset
79 if (isempty (hax))
854cfc72c64f patch.m: Update to use new __plt_get_axis_arg__.
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 14363
diff changeset
80 hax = gca ();
854cfc72c64f patch.m: Update to use new __plt_get_axis_arg__.
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 14363
diff changeset
81 endif
854cfc72c64f patch.m: Update to use new __plt_get_axis_arg__.
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 14363
diff changeset
82
854cfc72c64f patch.m: Update to use new __plt_get_axis_arg__.
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 14363
diff changeset
83 [htmp, failed] = __patch__ (hax, varargin{:});
7216
5389a52df87b [project @ 2007-11-29 19:07:29 by jwe]
jwe
parents: 7215
diff changeset
84
13802
630d3c80b541 allow axes handle to be passed to patch function
John W. Eaton <jwe@octave.org>
parents: 13299
diff changeset
85 if (failed)
630d3c80b541 allow axes handle to be passed to patch function
John W. Eaton <jwe@octave.org>
parents: 13299
diff changeset
86 print_usage ();
630d3c80b541 allow axes handle to be passed to patch function
John W. Eaton <jwe@octave.org>
parents: 13299
diff changeset
87 endif
7020
e31f12bb9194 [project @ 2007-10-13 05:13:28 by dbateman]
dbateman
parents: 7017
diff changeset
88
6807
0089a504fdd6 [project @ 2007-08-10 17:34:59 by jwe]
jwe
parents:
diff changeset
89 if (nargout > 0)
17126
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 17039
diff changeset
90 h = htmp;
6807
0089a504fdd6 [project @ 2007-08-10 17:34:59 by jwe]
jwe
parents:
diff changeset
91 endif
0089a504fdd6 [project @ 2007-08-10 17:34:59 by jwe]
jwe
parents:
diff changeset
92
0089a504fdd6 [project @ 2007-08-10 17:34:59 by jwe]
jwe
parents:
diff changeset
93 endfunction
7020
e31f12bb9194 [project @ 2007-10-13 05:13:28 by dbateman]
dbateman
parents: 7017
diff changeset
94
14237
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
95
7020
e31f12bb9194 [project @ 2007-10-13 05:13:28 by dbateman]
dbateman
parents: 7017
diff changeset
96 %!demo
14245
4506eade9f04 Use Matlab coding conventions for demos in plot/ directory.
Rik <octave@nomad.inbox5.com>
parents: 14237
diff changeset
97 %! %% Patches with same number of vertices
14237
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
98 %! clf;
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
99 %! t1 = (1/16:1/8:1)' * 2*pi;
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
100 %! t2 = ((1/16:1/8:1)' + 1/32) * 2*pi;
14001
5f0bb45e615c doc: Update documentation for functions returning a graphics handle h (Bug #34761)
Rik <octave@nomad.inbox5.com>
parents: 13811
diff changeset
101 %! x1 = sin (t1) - 0.8;
5f0bb45e615c doc: Update documentation for functions returning a graphics handle h (Bug #34761)
Rik <octave@nomad.inbox5.com>
parents: 13811
diff changeset
102 %! y1 = cos (t1);
5f0bb45e615c doc: Update documentation for functions returning a graphics handle h (Bug #34761)
Rik <octave@nomad.inbox5.com>
parents: 13811
diff changeset
103 %! x2 = sin (t2) + 0.8;
5f0bb45e615c doc: Update documentation for functions returning a graphics handle h (Bug #34761)
Rik <octave@nomad.inbox5.com>
parents: 13811
diff changeset
104 %! y2 = cos (t2);
14237
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
105 %! patch ([x1,x2], [y1,y2], 'r');
7020
e31f12bb9194 [project @ 2007-10-13 05:13:28 by dbateman]
dbateman
parents: 7017
diff changeset
106
e31f12bb9194 [project @ 2007-10-13 05:13:28 by dbateman]
dbateman
parents: 7017
diff changeset
107 %!demo
14245
4506eade9f04 Use Matlab coding conventions for demos in plot/ directory.
Rik <octave@nomad.inbox5.com>
parents: 14237
diff changeset
108 %! %% Unclosed patch
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 %! clf;
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
110 %! t1 = (1/16:1/8:1)' * 2*pi;
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
111 %! t2 = ((1/16:1/16:1)' + 1/32) * 2*pi;
14001
5f0bb45e615c doc: Update documentation for functions returning a graphics handle h (Bug #34761)
Rik <octave@nomad.inbox5.com>
parents: 13811
diff changeset
112 %! x1 = sin (t1) - 0.8;
5f0bb45e615c doc: Update documentation for functions returning a graphics handle h (Bug #34761)
Rik <octave@nomad.inbox5.com>
parents: 13811
diff changeset
113 %! y1 = cos (t1);
5f0bb45e615c doc: Update documentation for functions returning a graphics handle h (Bug #34761)
Rik <octave@nomad.inbox5.com>
parents: 13811
diff changeset
114 %! x2 = sin (t2) + 0.8;
5f0bb45e615c doc: Update documentation for functions returning a graphics handle h (Bug #34761)
Rik <octave@nomad.inbox5.com>
parents: 13811
diff changeset
115 %! y2 = cos (t2);
14237
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
116 %! patch ([[x1;NaN(8,1)],x2], [[y1;NaN(8,1)],y2], 'r');
7020
e31f12bb9194 [project @ 2007-10-13 05:13:28 by dbateman]
dbateman
parents: 7017
diff changeset
117
e31f12bb9194 [project @ 2007-10-13 05:13:28 by dbateman]
dbateman
parents: 7017
diff changeset
118 %!demo
14245
4506eade9f04 Use Matlab coding conventions for demos in plot/ directory.
Rik <octave@nomad.inbox5.com>
parents: 14237
diff changeset
119 %! %% Specify vertices and faces separately
14237
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
120 %! clf;
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
121 %! t1 = (1/16:1/8:1)' * 2*pi;
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
122 %! t2 = ((1/16:1/16:1)' + 1/32) * 2*pi;
14001
5f0bb45e615c doc: Update documentation for functions returning a graphics handle h (Bug #34761)
Rik <octave@nomad.inbox5.com>
parents: 13811
diff changeset
123 %! x1 = sin (t1) - 0.8;
5f0bb45e615c doc: Update documentation for functions returning a graphics handle h (Bug #34761)
Rik <octave@nomad.inbox5.com>
parents: 13811
diff changeset
124 %! y1 = cos (t1);
5f0bb45e615c doc: Update documentation for functions returning a graphics handle h (Bug #34761)
Rik <octave@nomad.inbox5.com>
parents: 13811
diff changeset
125 %! x2 = sin (t2) + 0.8;
5f0bb45e615c doc: Update documentation for functions returning a graphics handle h (Bug #34761)
Rik <octave@nomad.inbox5.com>
parents: 13811
diff changeset
126 %! y2 = cos (t2);
7020
e31f12bb9194 [project @ 2007-10-13 05:13:28 by dbateman]
dbateman
parents: 7017
diff changeset
127 %! vert = [x1, y1; x2, y2];
e31f12bb9194 [project @ 2007-10-13 05:13:28 by dbateman]
dbateman
parents: 7017
diff changeset
128 %! fac = [1:8,NaN(1,8);9:24];
14245
4506eade9f04 Use Matlab coding conventions for demos in plot/ directory.
Rik <octave@nomad.inbox5.com>
parents: 14237
diff changeset
129 %! patch ('Faces',fac, 'Vertices',vert, 'FaceColor','r');
7020
e31f12bb9194 [project @ 2007-10-13 05:13:28 by dbateman]
dbateman
parents: 7017
diff changeset
130
e31f12bb9194 [project @ 2007-10-13 05:13:28 by dbateman]
dbateman
parents: 7017
diff changeset
131 %!demo
14245
4506eade9f04 Use Matlab coding conventions for demos in plot/ directory.
Rik <octave@nomad.inbox5.com>
parents: 14237
diff changeset
132 %! %% Specify vertices and faces separately
14237
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
133 %! clf;
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
134 %! t1 = (1/16:1/8:1)' * 2*pi;
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
135 %! t2 = ((1/16:1/16:1)' + 1/32) * 2*pi;
14001
5f0bb45e615c doc: Update documentation for functions returning a graphics handle h (Bug #34761)
Rik <octave@nomad.inbox5.com>
parents: 13811
diff changeset
136 %! x1 = sin (t1) - 0.8;
5f0bb45e615c doc: Update documentation for functions returning a graphics handle h (Bug #34761)
Rik <octave@nomad.inbox5.com>
parents: 13811
diff changeset
137 %! y1 = cos (t1);
5f0bb45e615c doc: Update documentation for functions returning a graphics handle h (Bug #34761)
Rik <octave@nomad.inbox5.com>
parents: 13811
diff changeset
138 %! x2 = sin (t2) + 0.8;
5f0bb45e615c doc: Update documentation for functions returning a graphics handle h (Bug #34761)
Rik <octave@nomad.inbox5.com>
parents: 13811
diff changeset
139 %! y2 = cos (t2);
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: 8920
diff changeset
140 %! vert = [x1, y1; x2, y2];
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: 8920
diff changeset
141 %! fac = [1:8,NaN(1,8);9:24];
14363
f3d52523cde1 Use Octave coding conventions in all m-file %!test blocks
Rik <octave@nomad.inbox5.com>
parents: 14359
diff changeset
142 %! patch ('Faces',fac, 'Vertices',vert, 'FaceVertexCData',[0, 1, 0; 0, 0, 1]);
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: 8920
diff changeset
143
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: 8920
diff changeset
144 %!demo
14245
4506eade9f04 Use Matlab coding conventions for demos in plot/ directory.
Rik <octave@nomad.inbox5.com>
parents: 14237
diff changeset
145 %! %% Property change on multiple patches
14237
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
146 %! clf;
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
147 %! t1 = (1/16:1/8:1)' * 2*pi;
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
148 %! t2 = ((1/16:1/8:1)' + 1/32) * 2*pi;
14001
5f0bb45e615c doc: Update documentation for functions returning a graphics handle h (Bug #34761)
Rik <octave@nomad.inbox5.com>
parents: 13811
diff changeset
149 %! x1 = sin (t1) - 0.8;
5f0bb45e615c doc: Update documentation for functions returning a graphics handle h (Bug #34761)
Rik <octave@nomad.inbox5.com>
parents: 13811
diff changeset
150 %! y1 = cos (t1);
5f0bb45e615c doc: Update documentation for functions returning a graphics handle h (Bug #34761)
Rik <octave@nomad.inbox5.com>
parents: 13811
diff changeset
151 %! x2 = sin (t2) + 0.8;
5f0bb45e615c doc: Update documentation for functions returning a graphics handle h (Bug #34761)
Rik <octave@nomad.inbox5.com>
parents: 13811
diff changeset
152 %! y2 = cos (t2);
14363
f3d52523cde1 Use Octave coding conventions in all m-file %!test blocks
Rik <octave@nomad.inbox5.com>
parents: 14359
diff changeset
153 %! h = patch ([x1,x2], [y1,y2], cat (3, [0,0],[1,0],[0,1]));
7020
e31f12bb9194 [project @ 2007-10-13 05:13:28 by dbateman]
dbateman
parents: 7017
diff changeset
154 %! pause (1);
14245
4506eade9f04 Use Matlab coding conventions for demos in plot/ directory.
Rik <octave@nomad.inbox5.com>
parents: 14237
diff changeset
155 %! set (h, 'FaceColor', 'r');
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: 8920
diff changeset
156
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: 8920
diff changeset
157 %!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
158 %! clf;
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: 8920
diff changeset
159 %! vertices = [0, 0, 0;
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: 8920
diff changeset
160 %! 1, 0, 0;
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: 8920
diff changeset
161 %! 1, 1, 0;
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: 8920
diff changeset
162 %! 0, 1, 0;
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: 8920
diff changeset
163 %! 0.5, 0.5, 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: 8920
diff changeset
164 %! faces = [1, 2, 5;
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: 8920
diff changeset
165 %! 2, 3, 5;
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: 8920
diff changeset
166 %! 3, 4, 5;
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: 8920
diff changeset
167 %! 4, 1, 5];
14245
4506eade9f04 Use Matlab coding conventions for demos in plot/ directory.
Rik <octave@nomad.inbox5.com>
parents: 14237
diff changeset
168 %! patch ('Vertices', vertices, 'Faces', faces, ...
4506eade9f04 Use Matlab coding conventions for demos in plot/ directory.
Rik <octave@nomad.inbox5.com>
parents: 14237
diff changeset
169 %! 'FaceVertexCData', jet (4), 'FaceColor', 'flat');
14001
5f0bb45e615c doc: Update documentation for functions returning a graphics handle h (Bug #34761)
Rik <octave@nomad.inbox5.com>
parents: 13811
diff changeset
170 %! view (-37.5, 30);
12533
35f6e9a25296 patch.m: Add demo.
Ben Abbott <bpabbott@mac.com>
parents: 11587
diff changeset
171
35f6e9a25296 patch.m: Add demo.
Ben Abbott <bpabbott@mac.com>
parents: 11587
diff changeset
172 %!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
173 %! clf;
12533
35f6e9a25296 patch.m: Add demo.
Ben Abbott <bpabbott@mac.com>
parents: 11587
diff changeset
174 %! vertices = [0, 0, 0;
35f6e9a25296 patch.m: Add demo.
Ben Abbott <bpabbott@mac.com>
parents: 11587
diff changeset
175 %! 1, 0, 0;
35f6e9a25296 patch.m: Add demo.
Ben Abbott <bpabbott@mac.com>
parents: 11587
diff changeset
176 %! 1, 1, 0;
35f6e9a25296 patch.m: Add demo.
Ben Abbott <bpabbott@mac.com>
parents: 11587
diff changeset
177 %! 0, 1, 0;
35f6e9a25296 patch.m: Add demo.
Ben Abbott <bpabbott@mac.com>
parents: 11587
diff changeset
178 %! 0.5, 0.5, 1];
35f6e9a25296 patch.m: Add demo.
Ben Abbott <bpabbott@mac.com>
parents: 11587
diff changeset
179 %! faces = [1, 2, 5;
35f6e9a25296 patch.m: Add demo.
Ben Abbott <bpabbott@mac.com>
parents: 11587
diff changeset
180 %! 2, 3, 5;
35f6e9a25296 patch.m: Add demo.
Ben Abbott <bpabbott@mac.com>
parents: 11587
diff changeset
181 %! 3, 4, 5;
35f6e9a25296 patch.m: Add demo.
Ben Abbott <bpabbott@mac.com>
parents: 11587
diff changeset
182 %! 4, 1, 5];
14245
4506eade9f04 Use Matlab coding conventions for demos in plot/ directory.
Rik <octave@nomad.inbox5.com>
parents: 14237
diff changeset
183 %! patch ('Vertices', vertices, 'Faces', faces, ...
4506eade9f04 Use Matlab coding conventions for demos in plot/ directory.
Rik <octave@nomad.inbox5.com>
parents: 14237
diff changeset
184 %! 'FaceVertexCData', jet (5), 'FaceColor', 'interp');
14001
5f0bb45e615c doc: Update documentation for functions returning a graphics handle h (Bug #34761)
Rik <octave@nomad.inbox5.com>
parents: 13811
diff changeset
185 %! view (-37.5, 30);
12533
35f6e9a25296 patch.m: Add demo.
Ben Abbott <bpabbott@mac.com>
parents: 11587
diff changeset
186
13299
e9f6a6edec42 Improvements to patch() and fix for bugs reported in #34417.
Ben Abbott <bpabbott@mac.com>
parents: 13247
diff changeset
187 %!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
188 %! clf;
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
189 %! colormap (jet (64));
13299
e9f6a6edec42 Improvements to patch() and fix for bugs reported in #34417.
Ben Abbott <bpabbott@mac.com>
parents: 13247
diff changeset
190 %! x = [0 1 1 0];
e9f6a6edec42 Improvements to patch() and fix for bugs reported in #34417.
Ben Abbott <bpabbott@mac.com>
parents: 13247
diff changeset
191 %! y = [0 0 1 1];
14363
f3d52523cde1 Use Octave coding conventions in all m-file %!test blocks
Rik <octave@nomad.inbox5.com>
parents: 14359
diff changeset
192 %! subplot (2,1,1);
14245
4506eade9f04 Use Matlab coding conventions for demos in plot/ directory.
Rik <octave@nomad.inbox5.com>
parents: 14237
diff changeset
193 %! title ('Blue, Light-Green, and Red Horizontal Bars');
14237
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
194 %! patch (x, y + 0, 1);
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
195 %! patch (x, y + 1, 2);
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
196 %! patch (x, y + 2, 3);
14363
f3d52523cde1 Use Octave coding conventions in all m-file %!test blocks
Rik <octave@nomad.inbox5.com>
parents: 14359
diff changeset
197 %! subplot (2,1,2);
14245
4506eade9f04 Use Matlab coding conventions for demos in plot/ directory.
Rik <octave@nomad.inbox5.com>
parents: 14237
diff changeset
198 %! title ('Blue, Light-Green, and Red Vertical Bars');
14237
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
199 %! patch (x + 0, y, 1 * ones (size (x)));
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
200 %! patch (x + 1, y, 2 * ones (size (x)));
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
201 %! patch (x + 2, y, 3 * ones (size (x)));
13299
e9f6a6edec42 Improvements to patch() and fix for bugs reported in #34417.
Ben Abbott <bpabbott@mac.com>
parents: 13247
diff changeset
202
e9f6a6edec42 Improvements to patch() and fix for bugs reported in #34417.
Ben Abbott <bpabbott@mac.com>
parents: 13247
diff changeset
203 %!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
204 %! clf;
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
205 %! colormap (jet (64));
13299
e9f6a6edec42 Improvements to patch() and fix for bugs reported in #34417.
Ben Abbott <bpabbott@mac.com>
parents: 13247
diff changeset
206 %! x = [0 1 1 0];
e9f6a6edec42 Improvements to patch() and fix for bugs reported in #34417.
Ben Abbott <bpabbott@mac.com>
parents: 13247
diff changeset
207 %! y = [0 0 1 1];
14363
f3d52523cde1 Use Octave coding conventions in all m-file %!test blocks
Rik <octave@nomad.inbox5.com>
parents: 14359
diff changeset
208 %! subplot (2,1,1);
14245
4506eade9f04 Use Matlab coding conventions for demos in plot/ directory.
Rik <octave@nomad.inbox5.com>
parents: 14237
diff changeset
209 %! title ('Blue horizontal bars: Dark to Light');
4506eade9f04 Use Matlab coding conventions for demos in plot/ directory.
Rik <octave@nomad.inbox5.com>
parents: 14237
diff changeset
210 %! patch (x, y + 0, 1, 'cdatamapping', 'direct');
4506eade9f04 Use Matlab coding conventions for demos in plot/ directory.
Rik <octave@nomad.inbox5.com>
parents: 14237
diff changeset
211 %! patch (x, y + 1, 9, 'cdatamapping', 'direct');
4506eade9f04 Use Matlab coding conventions for demos in plot/ directory.
Rik <octave@nomad.inbox5.com>
parents: 14237
diff changeset
212 %! patch (x, y + 2, 17, 'cdatamapping', 'direct');
14363
f3d52523cde1 Use Octave coding conventions in all m-file %!test blocks
Rik <octave@nomad.inbox5.com>
parents: 14359
diff changeset
213 %! subplot (2,1,2);
14245
4506eade9f04 Use Matlab coding conventions for demos in plot/ directory.
Rik <octave@nomad.inbox5.com>
parents: 14237
diff changeset
214 %! title ('Blue vertical bars: Dark to Light');
4506eade9f04 Use Matlab coding conventions for demos in plot/ directory.
Rik <octave@nomad.inbox5.com>
parents: 14237
diff changeset
215 %! patch (x + 0, y, 1 * ones (size (x)), 'cdatamapping', 'direct');
4506eade9f04 Use Matlab coding conventions for demos in plot/ directory.
Rik <octave@nomad.inbox5.com>
parents: 14237
diff changeset
216 %! patch (x + 1, y, 9 * ones (size (x)), 'cdatamapping', 'direct');
4506eade9f04 Use Matlab coding conventions for demos in plot/ directory.
Rik <octave@nomad.inbox5.com>
parents: 14237
diff changeset
217 %! patch (x + 2, y, 17 * ones (size (x)), 'cdatamapping', 'direct');
13299
e9f6a6edec42 Improvements to patch() and fix for bugs reported in #34417.
Ben Abbott <bpabbott@mac.com>
parents: 13247
diff changeset
218
e9f6a6edec42 Improvements to patch() and fix for bugs reported in #34417.
Ben Abbott <bpabbott@mac.com>
parents: 13247
diff changeset
219 %!demo
e9f6a6edec42 Improvements to patch() and fix for bugs reported in #34417.
Ben Abbott <bpabbott@mac.com>
parents: 13247
diff changeset
220 %! clf;
14237
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
221 %! colormap (jet (64));
13299
e9f6a6edec42 Improvements to patch() and fix for bugs reported in #34417.
Ben Abbott <bpabbott@mac.com>
parents: 13247
diff changeset
222 %! x = [ 0 0; 1 1; 1 0 ];
e9f6a6edec42 Improvements to patch() and fix for bugs reported in #34417.
Ben Abbott <bpabbott@mac.com>
parents: 13247
diff changeset
223 %! y = [ 0 0; 0 1; 1 1 ];
14245
4506eade9f04 Use Matlab coding conventions for demos in plot/ directory.
Rik <octave@nomad.inbox5.com>
parents: 14237
diff changeset
224 %! p = patch (x, y, 'facecolor', 'b');
4506eade9f04 Use Matlab coding conventions for demos in plot/ directory.
Rik <octave@nomad.inbox5.com>
parents: 14237
diff changeset
225 %! title ('Two blue triangles');
4506eade9f04 Use Matlab coding conventions for demos in plot/ directory.
Rik <octave@nomad.inbox5.com>
parents: 14237
diff changeset
226 %! set (p, 'cdatamapping', 'direct', 'facecolor', 'flat', 'cdata', [1 32]);
4506eade9f04 Use Matlab coding conventions for demos in plot/ directory.
Rik <octave@nomad.inbox5.com>
parents: 14237
diff changeset
227 %! title ('Direct mapping of colors: Light-Green UL and Blue LR triangles');
13299
e9f6a6edec42 Improvements to patch() and fix for bugs reported in #34417.
Ben Abbott <bpabbott@mac.com>
parents: 13247
diff changeset
228
e9f6a6edec42 Improvements to patch() and fix for bugs reported in #34417.
Ben Abbott <bpabbott@mac.com>
parents: 13247
diff changeset
229 %!demo
e9f6a6edec42 Improvements to patch() and fix for bugs reported in #34417.
Ben Abbott <bpabbott@mac.com>
parents: 13247
diff changeset
230 %! clf;
14237
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
231 %! colormap (jet (64));
13299
e9f6a6edec42 Improvements to patch() and fix for bugs reported in #34417.
Ben Abbott <bpabbott@mac.com>
parents: 13247
diff changeset
232 %! x = [ 0 0; 1 1; 1 0 ];
e9f6a6edec42 Improvements to patch() and fix for bugs reported in #34417.
Ben Abbott <bpabbott@mac.com>
parents: 13247
diff changeset
233 %! y = [ 0 0; 0 1; 1 1 ];
e9f6a6edec42 Improvements to patch() and fix for bugs reported in #34417.
Ben Abbott <bpabbott@mac.com>
parents: 13247
diff changeset
234 %! p = patch (x, y, [1 32]);
14245
4506eade9f04 Use Matlab coding conventions for demos in plot/ directory.
Rik <octave@nomad.inbox5.com>
parents: 14237
diff changeset
235 %! title ('Autoscaling of colors: Red UL and Blue LR triangles');
13299
e9f6a6edec42 Improvements to patch() and fix for bugs reported in #34417.
Ben Abbott <bpabbott@mac.com>
parents: 13247
diff changeset
236
13115
cd808de114c1 Allow surface and patch to be called w/o arguments. Adding and fixing tests.
Kai Habel <kai.habel@gmx.de>
parents: 12533
diff changeset
237 %!test
13124
2ea1658ad049 Don't use explicit figure number for tests to avoid interference with any figures opened by user.
Kai Habel <kai.habel@gmx.de>
parents: 13115
diff changeset
238 %! hf = figure ("visible", "off");
13141
e81ddf9cacd5 maint: untabify and remove trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 13124
diff changeset
239 %! unwind_protect
14237
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
240 %! h = patch ();
13115
cd808de114c1 Allow surface and patch to be called w/o arguments. Adding and fixing tests.
Kai Habel <kai.habel@gmx.de>
parents: 12533
diff changeset
241 %! assert (findobj (hf, "type", "patch"), h);
13811
240d6810204c update tests for patch
John W. Eaton <jwe@octave.org>
parents: 13802
diff changeset
242 %! assert (get (h, "xdata"), [0; 1; 0], eps);
240d6810204c update tests for patch
John W. Eaton <jwe@octave.org>
parents: 13802
diff changeset
243 %! assert (get (h, "ydata"), [1; 1; 0], eps);
14001
5f0bb45e615c doc: Update documentation for functions returning a graphics handle h (Bug #34761)
Rik <octave@nomad.inbox5.com>
parents: 13811
diff changeset
244 %! assert (isempty (get (h, "zdata")));
5f0bb45e615c doc: Update documentation for functions returning a graphics handle h (Bug #34761)
Rik <octave@nomad.inbox5.com>
parents: 13811
diff changeset
245 %! assert (isempty (get (h, "cdata")));
13115
cd808de114c1 Allow surface and patch to be called w/o arguments. Adding and fixing tests.
Kai Habel <kai.habel@gmx.de>
parents: 12533
diff changeset
246 %! assert (get (h, "faces"), [1, 2, 3], eps);
13811
240d6810204c update tests for patch
John W. Eaton <jwe@octave.org>
parents: 13802
diff changeset
247 %! assert (get (h, "vertices"), [0 1; 1 1; 0 0], eps);
13115
cd808de114c1 Allow surface and patch to be called w/o arguments. Adding and fixing tests.
Kai Habel <kai.habel@gmx.de>
parents: 12533
diff changeset
248 %! assert (get (h, "type"), "patch");
13811
240d6810204c update tests for patch
John W. Eaton <jwe@octave.org>
parents: 13802
diff changeset
249 %! assert (get (h, "facecolor"), [0 0 0]);
13115
cd808de114c1 Allow surface and patch to be called w/o arguments. Adding and fixing tests.
Kai Habel <kai.habel@gmx.de>
parents: 12533
diff changeset
250 %! assert (get (h, "linestyle"), get (0, "defaultpatchlinestyle"));
cd808de114c1 Allow surface and patch to be called w/o arguments. Adding and fixing tests.
Kai Habel <kai.habel@gmx.de>
parents: 12533
diff changeset
251 %! assert (get (h, "linewidth"), get (0, "defaultpatchlinewidth"), eps);
cd808de114c1 Allow surface and patch to be called w/o arguments. Adding and fixing tests.
Kai Habel <kai.habel@gmx.de>
parents: 12533
diff changeset
252 %! assert (get (h, "marker"), get (0, "defaultpatchmarker"));
cd808de114c1 Allow surface and patch to be called w/o arguments. Adding and fixing tests.
Kai Habel <kai.habel@gmx.de>
parents: 12533
diff changeset
253 %! assert (get (h, "markersize"), get (0, "defaultpatchmarkersize"));
cd808de114c1 Allow surface and patch to be called w/o arguments. Adding and fixing tests.
Kai Habel <kai.habel@gmx.de>
parents: 12533
diff changeset
254 %! unwind_protect_cleanup
cd808de114c1 Allow surface and patch to be called w/o arguments. Adding and fixing tests.
Kai Habel <kai.habel@gmx.de>
parents: 12533
diff changeset
255 %! close (hf);
cd808de114c1 Allow surface and patch to be called w/o arguments. Adding and fixing tests.
Kai Habel <kai.habel@gmx.de>
parents: 12533
diff changeset
256 %! end_unwind_protect
13247
e36c2f4ea8f5 Set clim correctly for patch objects:
Kai Habel <kai.habel@gmx.de>
parents: 13141
diff changeset
257
e36c2f4ea8f5 Set clim correctly for patch objects:
Kai Habel <kai.habel@gmx.de>
parents: 13141
diff changeset
258 %!test
e36c2f4ea8f5 Set clim correctly for patch objects:
Kai Habel <kai.habel@gmx.de>
parents: 13141
diff changeset
259 %! hf = figure ("visible", "off");
e36c2f4ea8f5 Set clim correctly for patch objects:
Kai Habel <kai.habel@gmx.de>
parents: 13141
diff changeset
260 %! c = 0.9;
e36c2f4ea8f5 Set clim correctly for patch objects:
Kai Habel <kai.habel@gmx.de>
parents: 13141
diff changeset
261 %! unwind_protect
e36c2f4ea8f5 Set clim correctly for patch objects:
Kai Habel <kai.habel@gmx.de>
parents: 13141
diff changeset
262 %! h = patch ([0 1 0], [0 1 1], c);
e36c2f4ea8f5 Set clim correctly for patch objects:
Kai Habel <kai.habel@gmx.de>
parents: 13141
diff changeset
263 %! assert (get (gca, "clim"), [c - 1, c + 1]);
e36c2f4ea8f5 Set clim correctly for patch objects:
Kai Habel <kai.habel@gmx.de>
parents: 13141
diff changeset
264 %! h = patch ([0 1 0], [0 1 1], 2 * c);
e36c2f4ea8f5 Set clim correctly for patch objects:
Kai Habel <kai.habel@gmx.de>
parents: 13141
diff changeset
265 %! assert (get (gca, "clim"), [c, 2 * c]);
e36c2f4ea8f5 Set clim correctly for patch objects:
Kai Habel <kai.habel@gmx.de>
parents: 13141
diff changeset
266 %! unwind_protect_cleanup
e36c2f4ea8f5 Set clim correctly for patch objects:
Kai Habel <kai.habel@gmx.de>
parents: 13141
diff changeset
267 %! close (hf);
13299
e9f6a6edec42 Improvements to patch() and fix for bugs reported in #34417.
Ben Abbott <bpabbott@mac.com>
parents: 13247
diff changeset
268 %! end_unwind_protect
14001
5f0bb45e615c doc: Update documentation for functions returning a graphics handle h (Bug #34761)
Rik <octave@nomad.inbox5.com>
parents: 13811
diff changeset
269