annotate scripts/plot/draw/patch.m @ 19630:0e1f5a750d00

maint: Periodic merge of gui-release to default.
author John W. Eaton <jwe@octave.org>
date Tue, 20 Jan 2015 10:24:46 -0500
parents 9a5e03801d23 446c46af4b42
children 4197fc428c7d
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
17744
d63878346099 maint: Update copyright notices for release.
John W. Eaton <jwe@octave.org>
parents: 17572
diff changeset
1 ## Copyright (C) 2005-2013 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})
17122
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{})
17122
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
17281
bc924baa2c4e doc: Add new @qcode macro for code samples which are quoted.
Rik <rik@octave.org>
parents: 17190
diff changeset
37 ## which all share a single color use a string value (e.g., @qcode{"r"} for
17122
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 ##
17122
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 ##
17122
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
17281
bc924baa2c4e doc: Add new @qcode macro for code samples which are quoted.
Rik <rik@octave.org>
parents: 17190
diff changeset
48 ## faces created from those vertices. In this case the
bc924baa2c4e doc: Add new @qcode macro for code samples which are quoted.
Rik <rik@octave.org>
parents: 17190
diff changeset
49 ## @qcode{"Vertices"} matrix will be an @nospell{Nx2} (2-D patch) or
bc924baa2c4e doc: Add new @qcode macro for code samples which are quoted.
Rik <rik@octave.org>
parents: 17190
diff changeset
50 ## @nospell{Nx3} (3-D path). The @nospell{MxN} @qcode{"Faces"} matrix
bc924baa2c4e doc: Add new @qcode macro for code samples which are quoted.
Rik <rik@octave.org>
parents: 17190
diff changeset
51 ## describes M polygons having N vertices---each row describes a
bc924baa2c4e doc: Add new @qcode macro for code samples which are quoted.
Rik <rik@octave.org>
parents: 17190
diff changeset
52 ## single polygon and each column entry is an index into the
bc924baa2c4e doc: Add new @qcode macro for code samples which are quoted.
Rik <rik@octave.org>
parents: 17190
diff changeset
53 ## @qcode{"Vertices"} matrix to identify a vertex. The patch object
bc924baa2c4e doc: Add new @qcode macro for code samples which are quoted.
Rik <rik@octave.org>
parents: 17190
diff changeset
54 ## can be created by directly passing the property/value pairs
bc924baa2c4e doc: Add new @qcode macro for code samples which are quoted.
Rik <rik@octave.org>
parents: 17190
diff changeset
55 ## @qcode{"Vertices"}/@var{verts}, @qcode{"Faces"}/@var{faces} as
bc924baa2c4e doc: Add new @qcode macro for code samples which are quoted.
Rik <rik@octave.org>
parents: 17190
diff changeset
56 ## inputs.
17122
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 17039
diff changeset
57 ##
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 17039
diff changeset
58 ## A third input form is to create a structure @var{fv} with the fields
17281
bc924baa2c4e doc: Add new @qcode macro for code samples which are quoted.
Rik <rik@octave.org>
parents: 17190
diff changeset
59 ## @qcode{"vertices"}, @qcode{"faces"}, and optionally
bc924baa2c4e doc: Add new @qcode macro for code samples which are quoted.
Rik <rik@octave.org>
parents: 17190
diff changeset
60 ## @qcode{"facevertexcdata"}.
17122
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 17039
diff changeset
61 ##
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 17039
diff changeset
62 ## 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
63 ## 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
64 ##
5f0bb45e615c doc: Update documentation for functions returning a graphics handle h (Bug #34761)
Rik <octave@nomad.inbox5.com>
parents: 13811
diff changeset
65 ## 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
66 ## object.
17122
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 17039
diff changeset
67 ##
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 17039
diff changeset
68 ## 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
69 ## customize them requires setting patch properties directly. Useful patch
17281
bc924baa2c4e doc: Add new @qcode macro for code samples which are quoted.
Rik <rik@octave.org>
parents: 17190
diff changeset
70 ## properties are: @qcode{"cdata"}, @qcode{"edgecolor"},
bc924baa2c4e doc: Add new @qcode macro for code samples which are quoted.
Rik <rik@octave.org>
parents: 17190
diff changeset
71 ## @qcode{"facecolor"}, @qcode{"faces"}, @qcode{"facevertexcdata"}.
17122
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 17039
diff changeset
72 ## @seealso{fill, get, set}
6807
0089a504fdd6 [project @ 2007-08-10 17:34:59 by jwe]
jwe
parents:
diff changeset
73 ## @end deftypefn
0089a504fdd6 [project @ 2007-08-10 17:34:59 by jwe]
jwe
parents:
diff changeset
74
0089a504fdd6 [project @ 2007-08-10 17:34:59 by jwe]
jwe
parents:
diff changeset
75 ## Author: jwe
0089a504fdd6 [project @ 2007-08-10 17:34:59 by jwe]
jwe
parents:
diff changeset
76
17122
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 17039
diff changeset
77 function h = patch (varargin)
6807
0089a504fdd6 [project @ 2007-08-10 17:34:59 by jwe]
jwe
parents:
diff changeset
78
17039
854cfc72c64f patch.m: Update to use new __plt_get_axis_arg__.
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 14363
diff changeset
79 [hax, varargin] = __plt_get_axis_arg__ ("patch", varargin{:});
19627
446c46af4b42 strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
80
17039
854cfc72c64f patch.m: Update to use new __plt_get_axis_arg__.
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 14363
diff changeset
81 if (isempty (hax))
854cfc72c64f patch.m: Update to use new __plt_get_axis_arg__.
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 14363
diff changeset
82 hax = gca ();
18860
87c3848cf3c0 Fix bug when hggroup used with primitive graphic object (bug #42532).
Rik <rik@octave.org>
parents: 18802
diff changeset
83 else
87c3848cf3c0 Fix bug when hggroup used with primitive graphic object (bug #42532).
Rik <rik@octave.org>
parents: 18802
diff changeset
84 hax = hax(1);
17039
854cfc72c64f patch.m: Update to use new __plt_get_axis_arg__.
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 14363
diff changeset
85 endif
19627
446c46af4b42 strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
86
17039
854cfc72c64f patch.m: Update to use new __plt_get_axis_arg__.
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 14363
diff changeset
87 [htmp, failed] = __patch__ (hax, varargin{:});
7216
5389a52df87b [project @ 2007-11-29 19:07:29 by jwe]
jwe
parents: 7215
diff changeset
88
13802
630d3c80b541 allow axes handle to be passed to patch function
John W. Eaton <jwe@octave.org>
parents: 13299
diff changeset
89 if (failed)
630d3c80b541 allow axes handle to be passed to patch function
John W. Eaton <jwe@octave.org>
parents: 13299
diff changeset
90 print_usage ();
630d3c80b541 allow axes handle to be passed to patch function
John W. Eaton <jwe@octave.org>
parents: 13299
diff changeset
91 endif
7020
e31f12bb9194 [project @ 2007-10-13 05:13:28 by dbateman]
dbateman
parents: 7017
diff changeset
92
18802
75f8926deef1 Fix Z-order stacking of patches and axes grid lines (bug #40722).
Rik <rik@octave.org>
parents: 17744
diff changeset
93 ## FIXME: This is a hack to get 'layer' command to work for 2D patches
75f8926deef1 Fix Z-order stacking of patches and axes grid lines (bug #40722).
Rik <rik@octave.org>
parents: 17744
diff changeset
94 ## Alternative is much more complicated surgery in graphics.cc.
75f8926deef1 Fix Z-order stacking of patches and axes grid lines (bug #40722).
Rik <rik@octave.org>
parents: 17744
diff changeset
95 ## of get_children_limits() for 'z' axis and 'patch' object type.
75f8926deef1 Fix Z-order stacking of patches and axes grid lines (bug #40722).
Rik <rik@octave.org>
parents: 17744
diff changeset
96 if (! ishold ())
75f8926deef1 Fix Z-order stacking of patches and axes grid lines (bug #40722).
Rik <rik@octave.org>
parents: 17744
diff changeset
97 if (isempty (get (htmp, "zdata")))
75f8926deef1 Fix Z-order stacking of patches and axes grid lines (bug #40722).
Rik <rik@octave.org>
parents: 17744
diff changeset
98 set (hax, "zlim", [-1 1]);
75f8926deef1 Fix Z-order stacking of patches and axes grid lines (bug #40722).
Rik <rik@octave.org>
parents: 17744
diff changeset
99 endif
75f8926deef1 Fix Z-order stacking of patches and axes grid lines (bug #40722).
Rik <rik@octave.org>
parents: 17744
diff changeset
100 endif
75f8926deef1 Fix Z-order stacking of patches and axes grid lines (bug #40722).
Rik <rik@octave.org>
parents: 17744
diff changeset
101
6807
0089a504fdd6 [project @ 2007-08-10 17:34:59 by jwe]
jwe
parents:
diff changeset
102 if (nargout > 0)
17122
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 17039
diff changeset
103 h = htmp;
6807
0089a504fdd6 [project @ 2007-08-10 17:34:59 by jwe]
jwe
parents:
diff changeset
104 endif
0089a504fdd6 [project @ 2007-08-10 17:34:59 by jwe]
jwe
parents:
diff changeset
105
0089a504fdd6 [project @ 2007-08-10 17:34:59 by jwe]
jwe
parents:
diff changeset
106 endfunction
7020
e31f12bb9194 [project @ 2007-10-13 05:13:28 by dbateman]
dbateman
parents: 7017
diff changeset
107
14237
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
108
7020
e31f12bb9194 [project @ 2007-10-13 05:13:28 by dbateman]
dbateman
parents: 7017
diff changeset
109 %!demo
14245
4506eade9f04 Use Matlab coding conventions for demos in plot/ directory.
Rik <octave@nomad.inbox5.com>
parents: 14237
diff changeset
110 %! %% 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
111 %! clf;
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
112 %! 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
113 %! 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
114 %! 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
115 %! 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
116 %! 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
117 %! 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
118 %! patch ([x1,x2], [y1,y2], 'r');
7020
e31f12bb9194 [project @ 2007-10-13 05:13:28 by dbateman]
dbateman
parents: 7017
diff changeset
119
e31f12bb9194 [project @ 2007-10-13 05:13:28 by dbateman]
dbateman
parents: 7017
diff changeset
120 %!demo
14245
4506eade9f04 Use Matlab coding conventions for demos in plot/ directory.
Rik <octave@nomad.inbox5.com>
parents: 14237
diff changeset
121 %! %% 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
122 %! clf;
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
123 %! 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
124 %! 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
125 %! 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
126 %! 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
127 %! 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
128 %! 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
129 %! 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
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);
7020
e31f12bb9194 [project @ 2007-10-13 05:13:28 by dbateman]
dbateman
parents: 7017
diff changeset
140 %! vert = [x1, y1; x2, y2];
e31f12bb9194 [project @ 2007-10-13 05:13:28 by dbateman]
dbateman
parents: 7017
diff changeset
141 %! 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
142 %! patch ('Faces',fac, 'Vertices',vert, 'FaceColor','r');
7020
e31f12bb9194 [project @ 2007-10-13 05:13:28 by dbateman]
dbateman
parents: 7017
diff changeset
143
e31f12bb9194 [project @ 2007-10-13 05:13:28 by dbateman]
dbateman
parents: 7017
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 %! %% 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
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/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
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);
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
153 %! 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
154 %! fac = [1:8,NaN(1,8);9:24];
18935
df972b9d080a Translate patch property listeners to C++ (bug #42159)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18860
diff changeset
155 %! patch ('Faces',fac, 'Vertices',vert, ...
df972b9d080a Translate patch property listeners to C++ (bug #42159)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18860
diff changeset
156 %! 'FaceVertexCData',[0, 1, 0; 0, 0, 1], 'FaceColor', 'flat');
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
157
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
158 %!demo
14245
4506eade9f04 Use Matlab coding conventions for demos in plot/ directory.
Rik <octave@nomad.inbox5.com>
parents: 14237
diff changeset
159 %! %% 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
160 %! clf;
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
161 %! 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
162 %! 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
163 %! 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
164 %! 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
165 %! 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
166 %! y2 = cos (t2);
14363
f3d52523cde1 Use Octave coding conventions in all m-file %!test blocks
Rik <octave@nomad.inbox5.com>
parents: 14359
diff changeset
167 %! 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
168 %! pause (1);
14245
4506eade9f04 Use Matlab coding conventions for demos in plot/ directory.
Rik <octave@nomad.inbox5.com>
parents: 14237
diff changeset
169 %! 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
170
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
171 %!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
172 %! 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
173 %! 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
174 %! 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
175 %! 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
176 %! 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
177 %! 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
178 %! 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
179 %! 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
180 %! 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
181 %! 4, 1, 5];
14245
4506eade9f04 Use Matlab coding conventions for demos in plot/ directory.
Rik <octave@nomad.inbox5.com>
parents: 14237
diff changeset
182 %! patch ('Vertices', vertices, 'Faces', faces, ...
4506eade9f04 Use Matlab coding conventions for demos in plot/ directory.
Rik <octave@nomad.inbox5.com>
parents: 14237
diff changeset
183 %! '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
184 %! view (-37.5, 30);
12533
35f6e9a25296 patch.m: Add demo.
Ben Abbott <bpabbott@mac.com>
parents: 11587
diff changeset
185
35f6e9a25296 patch.m: Add demo.
Ben Abbott <bpabbott@mac.com>
parents: 11587
diff changeset
186 %!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
187 %! clf;
12533
35f6e9a25296 patch.m: Add demo.
Ben Abbott <bpabbott@mac.com>
parents: 11587
diff changeset
188 %! vertices = [0, 0, 0;
35f6e9a25296 patch.m: Add demo.
Ben Abbott <bpabbott@mac.com>
parents: 11587
diff changeset
189 %! 1, 0, 0;
35f6e9a25296 patch.m: Add demo.
Ben Abbott <bpabbott@mac.com>
parents: 11587
diff changeset
190 %! 1, 1, 0;
35f6e9a25296 patch.m: Add demo.
Ben Abbott <bpabbott@mac.com>
parents: 11587
diff changeset
191 %! 0, 1, 0;
35f6e9a25296 patch.m: Add demo.
Ben Abbott <bpabbott@mac.com>
parents: 11587
diff changeset
192 %! 0.5, 0.5, 1];
35f6e9a25296 patch.m: Add demo.
Ben Abbott <bpabbott@mac.com>
parents: 11587
diff changeset
193 %! faces = [1, 2, 5;
35f6e9a25296 patch.m: Add demo.
Ben Abbott <bpabbott@mac.com>
parents: 11587
diff changeset
194 %! 2, 3, 5;
35f6e9a25296 patch.m: Add demo.
Ben Abbott <bpabbott@mac.com>
parents: 11587
diff changeset
195 %! 3, 4, 5;
35f6e9a25296 patch.m: Add demo.
Ben Abbott <bpabbott@mac.com>
parents: 11587
diff changeset
196 %! 4, 1, 5];
14245
4506eade9f04 Use Matlab coding conventions for demos in plot/ directory.
Rik <octave@nomad.inbox5.com>
parents: 14237
diff changeset
197 %! patch ('Vertices', vertices, 'Faces', faces, ...
4506eade9f04 Use Matlab coding conventions for demos in plot/ directory.
Rik <octave@nomad.inbox5.com>
parents: 14237
diff changeset
198 %! '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
199 %! view (-37.5, 30);
12533
35f6e9a25296 patch.m: Add demo.
Ben Abbott <bpabbott@mac.com>
parents: 11587
diff changeset
200
13299
e9f6a6edec42 Improvements to patch() and fix for bugs reported in #34417.
Ben Abbott <bpabbott@mac.com>
parents: 13247
diff changeset
201 %!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
202 %! clf;
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
203 %! colormap (jet (64));
13299
e9f6a6edec42 Improvements to patch() and fix for bugs reported in #34417.
Ben Abbott <bpabbott@mac.com>
parents: 13247
diff changeset
204 %! 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
205 %! 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
206 %! subplot (2,1,1);
14245
4506eade9f04 Use Matlab coding conventions for demos in plot/ directory.
Rik <octave@nomad.inbox5.com>
parents: 14237
diff changeset
207 %! 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
208 %! 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
209 %! 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
210 %! 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
211 %! subplot (2,1,2);
14245
4506eade9f04 Use Matlab coding conventions for demos in plot/ directory.
Rik <octave@nomad.inbox5.com>
parents: 14237
diff changeset
212 %! 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
213 %! 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
214 %! 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
215 %! 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
216
e9f6a6edec42 Improvements to patch() and fix for bugs reported in #34417.
Ben Abbott <bpabbott@mac.com>
parents: 13247
diff changeset
217 %!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
218 %! clf;
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
219 %! colormap (jet (64));
13299
e9f6a6edec42 Improvements to patch() and fix for bugs reported in #34417.
Ben Abbott <bpabbott@mac.com>
parents: 13247
diff changeset
220 %! 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
221 %! 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
222 %! subplot (2,1,1);
14245
4506eade9f04 Use Matlab coding conventions for demos in plot/ directory.
Rik <octave@nomad.inbox5.com>
parents: 14237
diff changeset
223 %! 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
224 %! 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
225 %! 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
226 %! 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
227 %! subplot (2,1,2);
14245
4506eade9f04 Use Matlab coding conventions for demos in plot/ directory.
Rik <octave@nomad.inbox5.com>
parents: 14237
diff changeset
228 %! 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
229 %! 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
230 %! 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
231 %! 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
232
e9f6a6edec42 Improvements to patch() and fix for bugs reported in #34417.
Ben Abbott <bpabbott@mac.com>
parents: 13247
diff changeset
233 %!demo
e9f6a6edec42 Improvements to patch() and fix for bugs reported in #34417.
Ben Abbott <bpabbott@mac.com>
parents: 13247
diff changeset
234 %! 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
235 %! colormap (jet (64));
13299
e9f6a6edec42 Improvements to patch() and fix for bugs reported in #34417.
Ben Abbott <bpabbott@mac.com>
parents: 13247
diff changeset
236 %! 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
237 %! y = [ 0 0; 0 1; 1 1 ];
18958
9a5e03801d23 Update some plot %!demos so that they run under Matlab.
Rik <rik@octave.org>
parents: 18935
diff changeset
238 %! p = patch (x, y, 'b');
14245
4506eade9f04 Use Matlab coding conventions for demos in plot/ directory.
Rik <octave@nomad.inbox5.com>
parents: 14237
diff changeset
239 %! 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
240 %! 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
241
e9f6a6edec42 Improvements to patch() and fix for bugs reported in #34417.
Ben Abbott <bpabbott@mac.com>
parents: 13247
diff changeset
242 %!demo
e9f6a6edec42 Improvements to patch() and fix for bugs reported in #34417.
Ben Abbott <bpabbott@mac.com>
parents: 13247
diff changeset
243 %! 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
244 %! colormap (jet (64));
13299
e9f6a6edec42 Improvements to patch() and fix for bugs reported in #34417.
Ben Abbott <bpabbott@mac.com>
parents: 13247
diff changeset
245 %! 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
246 %! 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
247 %! 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
248 %! 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
249
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 %!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
251 %! 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
252 %! 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
253 %! 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
254 %! assert (findobj (hf, "type", "patch"), h);
13811
240d6810204c update tests for patch
John W. Eaton <jwe@octave.org>
parents: 13802
diff changeset
255 %! assert (get (h, "xdata"), [0; 1; 0], eps);
240d6810204c update tests for patch
John W. Eaton <jwe@octave.org>
parents: 13802
diff changeset
256 %! 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
257 %! 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
258 %! 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
259 %! assert (get (h, "faces"), [1, 2, 3], eps);
13811
240d6810204c update tests for patch
John W. Eaton <jwe@octave.org>
parents: 13802
diff changeset
260 %! 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
261 %! assert (get (h, "type"), "patch");
13811
240d6810204c update tests for patch
John W. Eaton <jwe@octave.org>
parents: 13802
diff changeset
262 %! 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
263 %! 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
264 %! 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
265 %! 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
266 %! 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
267 %! 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
268 %! 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
269 %! end_unwind_protect
13247
e36c2f4ea8f5 Set clim correctly for patch objects:
Kai Habel <kai.habel@gmx.de>
parents: 13141
diff changeset
270
e36c2f4ea8f5 Set clim correctly for patch objects:
Kai Habel <kai.habel@gmx.de>
parents: 13141
diff changeset
271 %!test
e36c2f4ea8f5 Set clim correctly for patch objects:
Kai Habel <kai.habel@gmx.de>
parents: 13141
diff changeset
272 %! hf = figure ("visible", "off");
e36c2f4ea8f5 Set clim correctly for patch objects:
Kai Habel <kai.habel@gmx.de>
parents: 13141
diff changeset
273 %! c = 0.9;
e36c2f4ea8f5 Set clim correctly for patch objects:
Kai Habel <kai.habel@gmx.de>
parents: 13141
diff changeset
274 %! unwind_protect
e36c2f4ea8f5 Set clim correctly for patch objects:
Kai Habel <kai.habel@gmx.de>
parents: 13141
diff changeset
275 %! 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
276 %! 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
277 %! 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
278 %! assert (get (gca, "clim"), [c, 2 * c]);
e36c2f4ea8f5 Set clim correctly for patch objects:
Kai Habel <kai.habel@gmx.de>
parents: 13141
diff changeset
279 %! unwind_protect_cleanup
e36c2f4ea8f5 Set clim correctly for patch objects:
Kai Habel <kai.habel@gmx.de>
parents: 13141
diff changeset
280 %! close (hf);
13299
e9f6a6edec42 Improvements to patch() and fix for bugs reported in #34417.
Ben Abbott <bpabbott@mac.com>
parents: 13247
diff changeset
281 %! 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
282