Mercurial > hg > octave-nkf
annotate scripts/plot/draw/patch.m @ 19016:87c3848cf3c0
Fix bug when hggroup used with primitive graphic object (bug #42532).
* image.m, text.m, line.m, patch.m: __plt_get_axis_arg__ will return axis and
hggroup when 'parent' property is used. Select the first returned object
which is the axes, rather than passing both axis and hggroup to further plot
subroutines.
author | Rik <rik@octave.org> |
---|---|
date | Tue, 10 Jun 2014 14:03:09 -0700 |
parents | 75f8926deef1 |
children | df972b9d080a |
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 | 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}) |
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 | 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 | 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 | 73 ## @end deftypefn |
74 | |
75 ## Author: jwe | |
76 | |
17122
eaab03308c0b
doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents:
17039
diff
changeset
|
77 function h = patch (varargin) |
6807 | 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{:}); |
854cfc72c64f
patch.m: Update to use new __plt_get_axis_arg__.
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
14363
diff
changeset
|
80 |
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 (); |
19016
87c3848cf3c0
Fix bug when hggroup used with primitive graphic object (bug #42532).
Rik <rik@octave.org>
parents:
18957
diff
changeset
|
83 else |
87c3848cf3c0
Fix bug when hggroup used with primitive graphic object (bug #42532).
Rik <rik@octave.org>
parents:
18957
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 |
854cfc72c64f
patch.m: Update to use new __plt_get_axis_arg__.
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
14363
diff
changeset
|
86 |
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 | 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 | 92 |
18957
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 | 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 | 104 endif |
105 | |
106 endfunction | |
7020 | 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 | 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 | 119 |
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 | 130 |
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 | 140 %! vert = [x1, y1; x2, y2]; |
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 | 143 |
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]; |
14363
f3d52523cde1
Use Octave coding conventions in all m-file %!test blocks
Rik <octave@nomad.inbox5.com>
parents:
14359
diff
changeset
|
155 %! 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
|
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 |
14245
4506eade9f04
Use Matlab coding conventions for demos in plot/ directory.
Rik <octave@nomad.inbox5.com>
parents:
14237
diff
changeset
|
158 %! %% 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
|
159 %! clf; |
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
160 %! 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
|
161 %! 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
|
162 %! 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
|
163 %! 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
|
164 %! 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
|
165 %! y2 = cos (t2); |
14363
f3d52523cde1
Use Octave coding conventions in all m-file %!test blocks
Rik <octave@nomad.inbox5.com>
parents:
14359
diff
changeset
|
166 %! h = patch ([x1,x2], [y1,y2], cat (3, [0,0],[1,0],[0,1])); |
7020 | 167 %! pause (1); |
14245
4506eade9f04
Use Matlab coding conventions for demos in plot/ directory.
Rik <octave@nomad.inbox5.com>
parents:
14237
diff
changeset
|
168 %! 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
|
169 |
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 %!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
|
171 %! 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
|
172 %! 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
|
173 %! 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
|
174 %! 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
|
175 %! 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
|
176 %! 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
|
177 %! 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
|
178 %! 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
|
179 %! 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
|
180 %! 4, 1, 5]; |
14245
4506eade9f04
Use Matlab coding conventions for demos in plot/ directory.
Rik <octave@nomad.inbox5.com>
parents:
14237
diff
changeset
|
181 %! patch ('Vertices', vertices, 'Faces', faces, ... |
4506eade9f04
Use Matlab coding conventions for demos in plot/ directory.
Rik <octave@nomad.inbox5.com>
parents:
14237
diff
changeset
|
182 %! '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
|
183 %! view (-37.5, 30); |
12533 | 184 |
185 %!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
|
186 %! clf; |
12533 | 187 %! vertices = [0, 0, 0; |
188 %! 1, 0, 0; | |
189 %! 1, 1, 0; | |
190 %! 0, 1, 0; | |
191 %! 0.5, 0.5, 1]; | |
192 %! faces = [1, 2, 5; | |
193 %! 2, 3, 5; | |
194 %! 3, 4, 5; | |
195 %! 4, 1, 5]; | |
14245
4506eade9f04
Use Matlab coding conventions for demos in plot/ directory.
Rik <octave@nomad.inbox5.com>
parents:
14237
diff
changeset
|
196 %! patch ('Vertices', vertices, 'Faces', faces, ... |
4506eade9f04
Use Matlab coding conventions for demos in plot/ directory.
Rik <octave@nomad.inbox5.com>
parents:
14237
diff
changeset
|
197 %! '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
|
198 %! view (-37.5, 30); |
12533 | 199 |
13299
e9f6a6edec42
Improvements to patch() and fix for bugs reported in #34417.
Ben Abbott <bpabbott@mac.com>
parents:
13247
diff
changeset
|
200 %!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
|
201 %! clf; |
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
202 %! colormap (jet (64)); |
13299
e9f6a6edec42
Improvements to patch() and fix for bugs reported in #34417.
Ben Abbott <bpabbott@mac.com>
parents:
13247
diff
changeset
|
203 %! 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
|
204 %! 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
|
205 %! subplot (2,1,1); |
14245
4506eade9f04
Use Matlab coding conventions for demos in plot/ directory.
Rik <octave@nomad.inbox5.com>
parents:
14237
diff
changeset
|
206 %! 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
|
207 %! 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
|
208 %! 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
|
209 %! 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
|
210 %! subplot (2,1,2); |
14245
4506eade9f04
Use Matlab coding conventions for demos in plot/ directory.
Rik <octave@nomad.inbox5.com>
parents:
14237
diff
changeset
|
211 %! 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
|
212 %! 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
|
213 %! 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
|
214 %! 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
|
215 |
e9f6a6edec42
Improvements to patch() and fix for bugs reported in #34417.
Ben Abbott <bpabbott@mac.com>
parents:
13247
diff
changeset
|
216 %!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
|
217 %! clf; |
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
218 %! colormap (jet (64)); |
13299
e9f6a6edec42
Improvements to patch() and fix for bugs reported in #34417.
Ben Abbott <bpabbott@mac.com>
parents:
13247
diff
changeset
|
219 %! 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
|
220 %! 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
|
221 %! subplot (2,1,1); |
14245
4506eade9f04
Use Matlab coding conventions for demos in plot/ directory.
Rik <octave@nomad.inbox5.com>
parents:
14237
diff
changeset
|
222 %! 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
|
223 %! 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
|
224 %! 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
|
225 %! 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
|
226 %! subplot (2,1,2); |
14245
4506eade9f04
Use Matlab coding conventions for demos in plot/ directory.
Rik <octave@nomad.inbox5.com>
parents:
14237
diff
changeset
|
227 %! 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
|
228 %! 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
|
229 %! 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
|
230 %! 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
|
231 |
e9f6a6edec42
Improvements to patch() and fix for bugs reported in #34417.
Ben Abbott <bpabbott@mac.com>
parents:
13247
diff
changeset
|
232 %!demo |
e9f6a6edec42
Improvements to patch() and fix for bugs reported in #34417.
Ben Abbott <bpabbott@mac.com>
parents:
13247
diff
changeset
|
233 %! 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
|
234 %! colormap (jet (64)); |
13299
e9f6a6edec42
Improvements to patch() and fix for bugs reported in #34417.
Ben Abbott <bpabbott@mac.com>
parents:
13247
diff
changeset
|
235 %! 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
|
236 %! 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
|
237 %! 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
|
238 %! 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
|
239 %! 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
|
240 |
e9f6a6edec42
Improvements to patch() and fix for bugs reported in #34417.
Ben Abbott <bpabbott@mac.com>
parents:
13247
diff
changeset
|
241 %!demo |
e9f6a6edec42
Improvements to patch() and fix for bugs reported in #34417.
Ben Abbott <bpabbott@mac.com>
parents:
13247
diff
changeset
|
242 %! 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
|
243 %! colormap (jet (64)); |
13299
e9f6a6edec42
Improvements to patch() and fix for bugs reported in #34417.
Ben Abbott <bpabbott@mac.com>
parents:
13247
diff
changeset
|
244 %! 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
|
245 %! 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
|
246 %! 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
|
247 %! 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
|
248 |
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
|
249 %!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
|
250 %! 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
|
251 %! 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
|
252 %! 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
|
253 %! assert (findobj (hf, "type", "patch"), h); |
13811 | 254 %! assert (get (h, "xdata"), [0; 1; 0], eps); |
255 %! 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
|
256 %! 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
|
257 %! 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
|
258 %! assert (get (h, "faces"), [1, 2, 3], eps); |
13811 | 259 %! 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
|
260 %! assert (get (h, "type"), "patch"); |
13811 | 261 %! 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
|
262 %! 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
|
263 %! 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
|
264 %! 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
|
265 %! 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
|
266 %! 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
|
267 %! 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
|
268 %! end_unwind_protect |
13247
e36c2f4ea8f5
Set clim correctly for patch objects:
Kai Habel <kai.habel@gmx.de>
parents:
13141
diff
changeset
|
269 |
e36c2f4ea8f5
Set clim correctly for patch objects:
Kai Habel <kai.habel@gmx.de>
parents:
13141
diff
changeset
|
270 %!test |
e36c2f4ea8f5
Set clim correctly for patch objects:
Kai Habel <kai.habel@gmx.de>
parents:
13141
diff
changeset
|
271 %! hf = figure ("visible", "off"); |
e36c2f4ea8f5
Set clim correctly for patch objects:
Kai Habel <kai.habel@gmx.de>
parents:
13141
diff
changeset
|
272 %! c = 0.9; |
e36c2f4ea8f5
Set clim correctly for patch objects:
Kai Habel <kai.habel@gmx.de>
parents:
13141
diff
changeset
|
273 %! unwind_protect |
e36c2f4ea8f5
Set clim correctly for patch objects:
Kai Habel <kai.habel@gmx.de>
parents:
13141
diff
changeset
|
274 %! 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
|
275 %! 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
|
276 %! 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
|
277 %! assert (get (gca, "clim"), [c, 2 * c]); |
e36c2f4ea8f5
Set clim correctly for patch objects:
Kai Habel <kai.habel@gmx.de>
parents:
13141
diff
changeset
|
278 %! unwind_protect_cleanup |
e36c2f4ea8f5
Set clim correctly for patch objects:
Kai Habel <kai.habel@gmx.de>
parents:
13141
diff
changeset
|
279 %! close (hf); |
13299
e9f6a6edec42
Improvements to patch() and fix for bugs reported in #34417.
Ben Abbott <bpabbott@mac.com>
parents:
13247
diff
changeset
|
280 %! 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
|
281 |