Mercurial > hg > octave-lyh
annotate scripts/plot/patch.m @ 14001:5f0bb45e615c
doc: Update documentation for functions returning a graphics handle h (Bug #34761)
* voronoi.m, image.m, imagesc.m, imshow.m, area.m, bar.m, barh.m, clabel.m,
clf.m, compass.m, ezcontour.m, ezcontourf.m, ezmesh.m, ezmeshc.m, ezplot.m,
ezplot3.m, ezpolar.m, ezsurf.m, ezsurfc.m, feather.m, fill.m, findall.m,
findobj.m, loglog.m, mesh.m, pareto.m, patch.m, pie.m, pie3.m, plot.m, polar.m,
quiver.m, quiver3.m, rectangle.m, ribbon.m, rose.m, scatter.m, scatter3.m,
semilogx.m, semilogy.m, slice.m, stem.m, surf.m, surface.m, text.m, title.m,
trimesh.m, triplot.m, trisurf.m, xlabel.m, ylabel.m, zlabel.m:
Update documentation for functions returning a graphics handle h.
author | Rik <octave@nomad.inbox5.com> |
---|---|
date | Tue, 06 Dec 2011 13:09:17 -0800 |
parents | 240d6810204c |
children | 72c96de7a403 |
rev | line source |
---|---|
11523 | 1 ## Copyright (C) 2005-2011 John W. Eaton |
6807 | 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. | |
6807 | 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/>. | |
6807 | 18 |
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 | 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}) |
7020 | 24 ## @deftypefnx {Function File} {} patch ('Faces', @var{f}, 'Vertices', @var{v}, @dots{}) |
25 ## @deftypefnx {Function File} {} patch (@dots{}, @var{prop}, @var{val}) | |
6988 | 26 ## @deftypefnx {Function File} {} patch (@var{h}, @dots{}) |
7650 | 27 ## @deftypefnx {Function File} {@var{h} =} patch (@dots{}) |
6895 | 28 ## Create patch object from @var{x} and @var{y} with color @var{c} and |
29 ## insert in the current axes object. Return handle to patch object. | |
30 ## | |
31 ## For a uniform colored patch, @var{c} can be given as an RGB vector, | |
32 ## scalar value referring to the current colormap, or string value (for | |
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
|
33 ## example, "r" or "red"). |
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
|
34 ## |
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
|
35 ## If passed a structure @var{fv} contain the fields "vertices", "faces" |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
36 ## and optionally "facevertexcdata", create the patch based on these |
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
|
37 ## properties. |
14001
5f0bb45e615c
doc: Update documentation for functions returning a graphics handle h (Bug #34761)
Rik <octave@nomad.inbox5.com>
parents:
13811
diff
changeset
|
38 ## |
5f0bb45e615c
doc: Update documentation for functions returning a graphics handle h (Bug #34761)
Rik <octave@nomad.inbox5.com>
parents:
13811
diff
changeset
|
39 ## 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
|
40 ## object. |
5f0bb45e615c
doc: Update documentation for functions returning a graphics handle h (Bug #34761)
Rik <octave@nomad.inbox5.com>
parents:
13811
diff
changeset
|
41 ## @seealso{fill} |
6807 | 42 ## @end deftypefn |
43 | |
44 ## Author: jwe | |
45 | |
7216 | 46 function retval = patch (varargin) |
6807 | 47 |
7215 | 48 [h, varargin] = __plt_get_axis_arg__ ("patch", varargin{:}); |
7216 | 49 |
13802
630d3c80b541
allow axes handle to be passed to patch function
John W. Eaton <jwe@octave.org>
parents:
13299
diff
changeset
|
50 [tmp, failed] = __patch__ (h, varargin{:}); |
7216 | 51 |
13802
630d3c80b541
allow axes handle to be passed to patch function
John W. Eaton <jwe@octave.org>
parents:
13299
diff
changeset
|
52 if (failed) |
630d3c80b541
allow axes handle to be passed to patch function
John W. Eaton <jwe@octave.org>
parents:
13299
diff
changeset
|
53 print_usage (); |
630d3c80b541
allow axes handle to be passed to patch function
John W. Eaton <jwe@octave.org>
parents:
13299
diff
changeset
|
54 endif |
7020 | 55 |
6807 | 56 if (nargout > 0) |
7216 | 57 retval = tmp; |
6807 | 58 endif |
59 | |
60 endfunction | |
7020 | 61 |
62 %!demo | |
63 %! ## Patches with same number of vertices | |
8790
a013ff655ca4
Trivial changes to demos to produce a more pleasant output for octave+gnuplot+aquaterm.
Ben Abbott <bpabbott@mac.com>
parents:
7650
diff
changeset
|
64 %! clf |
7020 | 65 %! t1 = (1/16:1/8:1)'*2*pi; |
66 %! 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
|
67 %! 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
|
68 %! 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
|
69 %! 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
|
70 %! y2 = cos (t2); |
7020 | 71 %! patch([x1,x2],[y1,y2],'r'); |
72 | |
73 %!demo | |
74 %! ## Unclosed patch | |
8790
a013ff655ca4
Trivial changes to demos to produce a more pleasant output for octave+gnuplot+aquaterm.
Ben Abbott <bpabbott@mac.com>
parents:
7650
diff
changeset
|
75 %! clf |
7020 | 76 %! t1 = (1/16:1/8:1)'*2*pi; |
77 %! 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
|
78 %! 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
|
79 %! 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
|
80 %! 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
|
81 %! y2 = cos (t2); |
7020 | 82 %! patch([[x1;NaN(8,1)],x2],[[y1;NaN(8,1)],y2],'r'); |
83 | |
84 %!demo | |
85 %! ## Specify vertices and faces separately | |
8790
a013ff655ca4
Trivial changes to demos to produce a more pleasant output for octave+gnuplot+aquaterm.
Ben Abbott <bpabbott@mac.com>
parents:
7650
diff
changeset
|
86 %! clf |
7020 | 87 %! t1 = (1/16:1/8:1)'*2*pi; |
88 %! 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
|
89 %! 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
|
90 %! 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
|
91 %! 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
|
92 %! y2 = cos (t2); |
7020 | 93 %! vert = [x1, y1; x2, y2]; |
94 %! fac = [1:8,NaN(1,8);9:24]; | |
95 %! patch('Faces',fac,'Vertices',vert,'FaceColor','r'); | |
96 | |
97 %!demo | |
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
|
98 %! ## Specify vertices and faces separately |
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
|
99 %! clf |
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
|
100 %! t1 = (1/16:1/8:1)'*2*pi; |
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
|
101 %! 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
|
102 %! 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
|
103 %! 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
|
104 %! 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
|
105 %! 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
|
106 %! 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
|
107 %! fac = [1:8,NaN(1,8);9:24]; |
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
|
108 %! patch('Faces',fac,'Vertices',vert,'FaceVertexCData', [0, 1, 0; 0, 0, 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
|
109 |
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
|
110 %!demo |
7020 | 111 %! ## Property change on multiple patches |
8790
a013ff655ca4
Trivial changes to demos to produce a more pleasant output for octave+gnuplot+aquaterm.
Ben Abbott <bpabbott@mac.com>
parents:
7650
diff
changeset
|
112 %! clf |
7020 | 113 %! t1 = (1/16:1/8:1)'*2*pi; |
114 %! 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
|
115 %! 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
|
116 %! 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
|
117 %! 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
|
118 %! y2 = cos (t2); |
7020 | 119 %! h = patch([x1,x2],[y1,y2],cat (3,[0,0],[1,0],[0,1])); |
120 %! pause (1); | |
121 %! 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
|
122 |
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
|
123 %!demo |
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
|
124 %! clf |
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
|
125 %! 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
|
126 %! 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
|
127 %! 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
|
128 %! 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
|
129 %! 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
|
130 %! 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
|
131 %! 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
|
132 %! 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
|
133 %! 4, 1, 5]; |
14001
5f0bb45e615c
doc: Update documentation for functions returning a graphics handle h (Bug #34761)
Rik <octave@nomad.inbox5.com>
parents:
13811
diff
changeset
|
134 %! patch ('Vertices', vertices, 'Faces', faces, ... |
5f0bb45e615c
doc: Update documentation for functions returning a graphics handle h (Bug #34761)
Rik <octave@nomad.inbox5.com>
parents:
13811
diff
changeset
|
135 %! 'FaceVertexCData', jet(4), 'FaceColor', 'flat'); |
5f0bb45e615c
doc: Update documentation for functions returning a graphics handle h (Bug #34761)
Rik <octave@nomad.inbox5.com>
parents:
13811
diff
changeset
|
136 %! view (-37.5, 30); |
12533 | 137 |
138 %!demo | |
139 %! clf | |
140 %! vertices = [0, 0, 0; | |
141 %! 1, 0, 0; | |
142 %! 1, 1, 0; | |
143 %! 0, 1, 0; | |
144 %! 0.5, 0.5, 1]; | |
145 %! faces = [1, 2, 5; | |
146 %! 2, 3, 5; | |
147 %! 3, 4, 5; | |
148 %! 4, 1, 5]; | |
14001
5f0bb45e615c
doc: Update documentation for functions returning a graphics handle h (Bug #34761)
Rik <octave@nomad.inbox5.com>
parents:
13811
diff
changeset
|
149 %! patch ('Vertices', vertices, 'Faces', faces, ... |
5f0bb45e615c
doc: Update documentation for functions returning a graphics handle h (Bug #34761)
Rik <octave@nomad.inbox5.com>
parents:
13811
diff
changeset
|
150 %! 'FaceVertexCData', jet(5), 'FaceColor', 'interp'); |
5f0bb45e615c
doc: Update documentation for functions returning a graphics handle h (Bug #34761)
Rik <octave@nomad.inbox5.com>
parents:
13811
diff
changeset
|
151 %! view (-37.5, 30); |
12533 | 152 |
13299
e9f6a6edec42
Improvements to patch() and fix for bugs reported in #34417.
Ben Abbott <bpabbott@mac.com>
parents:
13247
diff
changeset
|
153 %!demo |
e9f6a6edec42
Improvements to patch() and fix for bugs reported in #34417.
Ben Abbott <bpabbott@mac.com>
parents:
13247
diff
changeset
|
154 %! clf |
14001
5f0bb45e615c
doc: Update documentation for functions returning a graphics handle h (Bug #34761)
Rik <octave@nomad.inbox5.com>
parents:
13811
diff
changeset
|
155 %! colormap (jet); |
13299
e9f6a6edec42
Improvements to patch() and fix for bugs reported in #34417.
Ben Abbott <bpabbott@mac.com>
parents:
13247
diff
changeset
|
156 %! 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
|
157 %! y = [0 0 1 1]; |
14001
5f0bb45e615c
doc: Update documentation for functions returning a graphics handle h (Bug #34761)
Rik <octave@nomad.inbox5.com>
parents:
13811
diff
changeset
|
158 %! subplot (2, 1, 1); |
5f0bb45e615c
doc: Update documentation for functions returning a graphics handle h (Bug #34761)
Rik <octave@nomad.inbox5.com>
parents:
13811
diff
changeset
|
159 %! title ("Blue, Light-Green, and Red Horizontal Bars"); |
13299
e9f6a6edec42
Improvements to patch() and fix for bugs reported in #34417.
Ben Abbott <bpabbott@mac.com>
parents:
13247
diff
changeset
|
160 %! patch (x, y + 0, 1); |
e9f6a6edec42
Improvements to patch() and fix for bugs reported in #34417.
Ben Abbott <bpabbott@mac.com>
parents:
13247
diff
changeset
|
161 %! patch (x, y + 1, 2); |
e9f6a6edec42
Improvements to patch() and fix for bugs reported in #34417.
Ben Abbott <bpabbott@mac.com>
parents:
13247
diff
changeset
|
162 %! patch (x, y + 2, 3); |
14001
5f0bb45e615c
doc: Update documentation for functions returning a graphics handle h (Bug #34761)
Rik <octave@nomad.inbox5.com>
parents:
13811
diff
changeset
|
163 %! subplot (2, 1, 2); |
5f0bb45e615c
doc: Update documentation for functions returning a graphics handle h (Bug #34761)
Rik <octave@nomad.inbox5.com>
parents:
13811
diff
changeset
|
164 %! title ("Blue, Light-Green, and Red Vertical Bars"); |
13299
e9f6a6edec42
Improvements to patch() and fix for bugs reported in #34417.
Ben Abbott <bpabbott@mac.com>
parents:
13247
diff
changeset
|
165 %! patch (x + 0, y, 1 * ones (size (x))); |
e9f6a6edec42
Improvements to patch() and fix for bugs reported in #34417.
Ben Abbott <bpabbott@mac.com>
parents:
13247
diff
changeset
|
166 %! patch (x + 1, y, 2 * ones (size (x))); |
e9f6a6edec42
Improvements to patch() and fix for bugs reported in #34417.
Ben Abbott <bpabbott@mac.com>
parents:
13247
diff
changeset
|
167 %! patch (x + 2, y, 3 * ones (size (x))); |
e9f6a6edec42
Improvements to patch() and fix for bugs reported in #34417.
Ben Abbott <bpabbott@mac.com>
parents:
13247
diff
changeset
|
168 |
e9f6a6edec42
Improvements to patch() and fix for bugs reported in #34417.
Ben Abbott <bpabbott@mac.com>
parents:
13247
diff
changeset
|
169 %!demo |
e9f6a6edec42
Improvements to patch() and fix for bugs reported in #34417.
Ben Abbott <bpabbott@mac.com>
parents:
13247
diff
changeset
|
170 %! clf |
14001
5f0bb45e615c
doc: Update documentation for functions returning a graphics handle h (Bug #34761)
Rik <octave@nomad.inbox5.com>
parents:
13811
diff
changeset
|
171 %! colormap (jet); |
13299
e9f6a6edec42
Improvements to patch() and fix for bugs reported in #34417.
Ben Abbott <bpabbott@mac.com>
parents:
13247
diff
changeset
|
172 %! 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
|
173 %! y = [0 0 1 1]; |
14001
5f0bb45e615c
doc: Update documentation for functions returning a graphics handle h (Bug #34761)
Rik <octave@nomad.inbox5.com>
parents:
13811
diff
changeset
|
174 %! subplot (2, 1, 1); |
5f0bb45e615c
doc: Update documentation for functions returning a graphics handle h (Bug #34761)
Rik <octave@nomad.inbox5.com>
parents:
13811
diff
changeset
|
175 %! title ("Blue horizontal bars: Dark to Light"); |
13299
e9f6a6edec42
Improvements to patch() and fix for bugs reported in #34417.
Ben Abbott <bpabbott@mac.com>
parents:
13247
diff
changeset
|
176 %! patch (x, y + 0, 1, "cdatamapping", "direct"); |
e9f6a6edec42
Improvements to patch() and fix for bugs reported in #34417.
Ben Abbott <bpabbott@mac.com>
parents:
13247
diff
changeset
|
177 %! patch (x, y + 1, 9, "cdatamapping", "direct"); |
e9f6a6edec42
Improvements to patch() and fix for bugs reported in #34417.
Ben Abbott <bpabbott@mac.com>
parents:
13247
diff
changeset
|
178 %! patch (x, y + 2, 17, "cdatamapping", "direct"); |
14001
5f0bb45e615c
doc: Update documentation for functions returning a graphics handle h (Bug #34761)
Rik <octave@nomad.inbox5.com>
parents:
13811
diff
changeset
|
179 %! subplot (2, 1, 2); |
13299
e9f6a6edec42
Improvements to patch() and fix for bugs reported in #34417.
Ben Abbott <bpabbott@mac.com>
parents:
13247
diff
changeset
|
180 %! title ("Blue vertical bars: Dark to Light") |
e9f6a6edec42
Improvements to patch() and fix for bugs reported in #34417.
Ben Abbott <bpabbott@mac.com>
parents:
13247
diff
changeset
|
181 %! patch (x + 0, y, 1 * ones (size (x)), "cdatamapping", "direct"); |
e9f6a6edec42
Improvements to patch() and fix for bugs reported in #34417.
Ben Abbott <bpabbott@mac.com>
parents:
13247
diff
changeset
|
182 %! patch (x + 1, y, 9 * ones (size (x)), "cdatamapping", "direct"); |
e9f6a6edec42
Improvements to patch() and fix for bugs reported in #34417.
Ben Abbott <bpabbott@mac.com>
parents:
13247
diff
changeset
|
183 %! patch (x + 2, y, 17 * ones (size (x)), "cdatamapping", "direct"); |
e9f6a6edec42
Improvements to patch() and fix for bugs reported in #34417.
Ben Abbott <bpabbott@mac.com>
parents:
13247
diff
changeset
|
184 |
e9f6a6edec42
Improvements to patch() and fix for bugs reported in #34417.
Ben Abbott <bpabbott@mac.com>
parents:
13247
diff
changeset
|
185 %!demo |
e9f6a6edec42
Improvements to patch() and fix for bugs reported in #34417.
Ben Abbott <bpabbott@mac.com>
parents:
13247
diff
changeset
|
186 %! clf; |
e9f6a6edec42
Improvements to patch() and fix for bugs reported in #34417.
Ben Abbott <bpabbott@mac.com>
parents:
13247
diff
changeset
|
187 %! colormap (jet); |
e9f6a6edec42
Improvements to patch() and fix for bugs reported in #34417.
Ben Abbott <bpabbott@mac.com>
parents:
13247
diff
changeset
|
188 %! 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
|
189 %! 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
|
190 %! p = patch (x, y, "facecolor", "b"); |
14001
5f0bb45e615c
doc: Update documentation for functions returning a graphics handle h (Bug #34761)
Rik <octave@nomad.inbox5.com>
parents:
13811
diff
changeset
|
191 %! title ("Two blue triangles"); |
5f0bb45e615c
doc: Update documentation for functions returning a graphics handle h (Bug #34761)
Rik <octave@nomad.inbox5.com>
parents:
13811
diff
changeset
|
192 %! set (p, "cdatamapping", "direct", "facecolor", "flat", "cdata", [1 32]); |
5f0bb45e615c
doc: Update documentation for functions returning a graphics handle h (Bug #34761)
Rik <octave@nomad.inbox5.com>
parents:
13811
diff
changeset
|
193 %! 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
|
194 |
e9f6a6edec42
Improvements to patch() and fix for bugs reported in #34417.
Ben Abbott <bpabbott@mac.com>
parents:
13247
diff
changeset
|
195 %!demo |
e9f6a6edec42
Improvements to patch() and fix for bugs reported in #34417.
Ben Abbott <bpabbott@mac.com>
parents:
13247
diff
changeset
|
196 %! clf; |
e9f6a6edec42
Improvements to patch() and fix for bugs reported in #34417.
Ben Abbott <bpabbott@mac.com>
parents:
13247
diff
changeset
|
197 %! colormap (jet); |
e9f6a6edec42
Improvements to patch() and fix for bugs reported in #34417.
Ben Abbott <bpabbott@mac.com>
parents:
13247
diff
changeset
|
198 %! 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
|
199 %! 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
|
200 %! p = patch (x, y, [1 32]); |
14001
5f0bb45e615c
doc: Update documentation for functions returning a graphics handle h (Bug #34761)
Rik <octave@nomad.inbox5.com>
parents:
13811
diff
changeset
|
201 %! 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
|
202 |
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
|
203 %!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
|
204 %! 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
|
205 %! unwind_protect |
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
|
206 %! h = patch; |
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
|
207 %! assert (findobj (hf, "type", "patch"), h); |
13811 | 208 %! assert (get (h, "xdata"), [0; 1; 0], eps); |
209 %! 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
|
210 %! 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
|
211 %! 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
|
212 %! assert (get (h, "faces"), [1, 2, 3], eps); |
13811 | 213 %! 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
|
214 %! assert (get (h, "type"), "patch"); |
13811 | 215 %! 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
|
216 %! 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
|
217 %! 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
|
218 %! 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
|
219 %! 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
|
220 %! 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
|
221 %! 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
|
222 %! end_unwind_protect |
13247
e36c2f4ea8f5
Set clim correctly for patch objects:
Kai Habel <kai.habel@gmx.de>
parents:
13141
diff
changeset
|
223 |
e36c2f4ea8f5
Set clim correctly for patch objects:
Kai Habel <kai.habel@gmx.de>
parents:
13141
diff
changeset
|
224 %!test |
e36c2f4ea8f5
Set clim correctly for patch objects:
Kai Habel <kai.habel@gmx.de>
parents:
13141
diff
changeset
|
225 %! hf = figure ("visible", "off"); |
e36c2f4ea8f5
Set clim correctly for patch objects:
Kai Habel <kai.habel@gmx.de>
parents:
13141
diff
changeset
|
226 %! c = 0.9; |
e36c2f4ea8f5
Set clim correctly for patch objects:
Kai Habel <kai.habel@gmx.de>
parents:
13141
diff
changeset
|
227 %! unwind_protect |
e36c2f4ea8f5
Set clim correctly for patch objects:
Kai Habel <kai.habel@gmx.de>
parents:
13141
diff
changeset
|
228 %! 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
|
229 %! 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
|
230 %! 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
|
231 %! assert (get (gca, "clim"), [c, 2 * c]); |
e36c2f4ea8f5
Set clim correctly for patch objects:
Kai Habel <kai.habel@gmx.de>
parents:
13141
diff
changeset
|
232 %! unwind_protect_cleanup |
e36c2f4ea8f5
Set clim correctly for patch objects:
Kai Habel <kai.habel@gmx.de>
parents:
13141
diff
changeset
|
233 %! close (hf); |
13299
e9f6a6edec42
Improvements to patch() and fix for bugs reported in #34417.
Ben Abbott <bpabbott@mac.com>
parents:
13247
diff
changeset
|
234 %! 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
|
235 |