Mercurial > octave
annotate scripts/plot/draw/rectangle.m @ 32074:03fe0b635d2e
quiver/quiver3: Overhaul input processing, validation, and add BISTs.
* scripts/plot/draw/private/__quiver__.m: Overhaul numeric input validation.
Simplify input classification using numeric input count switch statements
and avoid quiver3 miscount due to scale factor. Add error messages for all
valid numeric input combinations including vector x,y,z and scale factor.
Move newplot command from quiver/quiver3 into __quiver__ after numeric input
validation. Add hax as an output argument to return any changes back to
calling function.
* scripts/plot/draw/quiver.m: Remove newplot call. Update __quiver__ call
to include hax as a return variable. Update docstring with note that line
style and name-value pairs can both be provided but linstyle must appear
first. Add BISTs to check standard inputs with single and multiple arrows,
arrowhead shape, vector and array inputs, proper treatment of scaling factor
"off", some simple input styles, and input validation BISTs to cover all
numeric input errors. Added known failing BIST for linestyle+pair
arrowhead showing when it should stay off (bug #64143).
* scripts/plot/draw/quiver3.m: Remove newplot call. Update __quiver__ call
to include hax as a return variable. Update docstring with note that line
style and name-value pairs can both be provided but linstyle must appear
first. Add BISTs to check standard inputs with single and multiple arrows,
vector and array inputs, and input validation BISTs to cover all numeric
input errors.
* etc/NEWS.9.md: Update quiver/quiver3 improvement description under General
Improvements.
author | Nicholas R. Jankowski <jankowski.nicholas@gmail.com> |
---|---|
date | Wed, 03 May 2023 22:52:33 -0400 |
parents | 597f3ee61a48 |
children | 2e484f9f1f18 |
rev | line source |
---|---|
27923
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
1 ######################################################################## |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
2 ## |
31706
597f3ee61a48
update Octave Project Developers copyright for the new year
John W. Eaton <jwe@octave.org>
parents:
30564
diff
changeset
|
3 ## Copyright (C) 2012-2023 The Octave Project Developers |
27918
b442ec6dda5c
use centralized file for copyright info for individual contributors
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
4 ## |
27923
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
5 ## See the file COPYRIGHT.md in the top-level directory of this |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
6 ## distribution or <https://octave.org/copyright/>. |
12697 | 7 ## |
8 ## This file is part of Octave. | |
9 ## | |
24534
194eb4bd202b
maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents:
24432
diff
changeset
|
10 ## Octave is free software: you can redistribute it and/or modify it |
12697 | 11 ## under the terms of the GNU General Public License as published by |
24534
194eb4bd202b
maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents:
24432
diff
changeset
|
12 ## the Free Software Foundation, either version 3 of the License, or |
22755
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
13 ## (at your option) any later version. |
12697 | 14 ## |
15 ## Octave is distributed in the hope that it will be useful, but | |
16 ## WITHOUT ANY WARRANTY; without even the implied warranty of | |
22755
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
17 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
18 ## GNU General Public License for more details. |
12697 | 19 ## |
20 ## You should have received a copy of the GNU General Public License | |
21 ## along with Octave; see the file COPYING. If not, see | |
24534
194eb4bd202b
maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents:
24432
diff
changeset
|
22 ## <https://www.gnu.org/licenses/>. |
27923
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
23 ## |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
24 ######################################################################## |
12697 | 25 |
26 ## -*- texinfo -*- | |
20852
516bb87ea72e
2015 Code Sprint: remove class of function from docstring for all m-files.
Rik <rik@octave.org>
parents:
20735
diff
changeset
|
27 ## @deftypefn {} {} rectangle () |
516bb87ea72e
2015 Code Sprint: remove class of function from docstring for all m-files.
Rik <rik@octave.org>
parents:
20735
diff
changeset
|
28 ## @deftypefnx {} {} rectangle (@dots{}, "Position", @var{pos}) |
516bb87ea72e
2015 Code Sprint: remove class of function from docstring for all m-files.
Rik <rik@octave.org>
parents:
20735
diff
changeset
|
29 ## @deftypefnx {} {} rectangle (@dots{}, "Curvature", @var{curv}) |
516bb87ea72e
2015 Code Sprint: remove class of function from docstring for all m-files.
Rik <rik@octave.org>
parents:
20735
diff
changeset
|
30 ## @deftypefnx {} {} rectangle (@dots{}, "EdgeColor", @var{ec}) |
516bb87ea72e
2015 Code Sprint: remove class of function from docstring for all m-files.
Rik <rik@octave.org>
parents:
20735
diff
changeset
|
31 ## @deftypefnx {} {} rectangle (@dots{}, "FaceColor", @var{fc}) |
516bb87ea72e
2015 Code Sprint: remove class of function from docstring for all m-files.
Rik <rik@octave.org>
parents:
20735
diff
changeset
|
32 ## @deftypefnx {} {} rectangle (@var{hax}, @dots{}) |
516bb87ea72e
2015 Code Sprint: remove class of function from docstring for all m-files.
Rik <rik@octave.org>
parents:
20735
diff
changeset
|
33 ## @deftypefnx {} {@var{h} =} rectangle (@dots{}) |
17122
eaab03308c0b
doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents:
17051
diff
changeset
|
34 ## Draw a rectangular patch defined by @var{pos} and @var{curv}. |
19593
446c46af4b42
strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents:
17744
diff
changeset
|
35 ## |
17122
eaab03308c0b
doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents:
17051
diff
changeset
|
36 ## The variable @code{@var{pos}(1:2)} defines the lower left-hand corner of |
eaab03308c0b
doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents:
17051
diff
changeset
|
37 ## the patch and @code{@var{pos}(3:4)} defines its width and height. By |
eaab03308c0b
doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents:
17051
diff
changeset
|
38 ## default, the value of @var{pos} is @code{[0, 0, 1, 1]}. |
12697 | 39 ## |
40 ## The variable @var{curv} defines the curvature of the sides of the rectangle | |
12761
13bcd62824a7
doc: Add documentation for gmres, rectangle to manual
Rik <octave@nomad.inbox5.com>
parents:
12698
diff
changeset
|
41 ## and may be a scalar or two-element vector with values between 0 and 1. |
13bcd62824a7
doc: Add documentation for gmres, rectangle to manual
Rik <octave@nomad.inbox5.com>
parents:
12698
diff
changeset
|
42 ## A value of 0 represents no curvature of the side, whereas a value of 1 |
13bcd62824a7
doc: Add documentation for gmres, rectangle to manual
Rik <octave@nomad.inbox5.com>
parents:
12698
diff
changeset
|
43 ## means that the side is entirely curved into the arc of a circle. |
13141
e81ddf9cacd5
maint: untabify and remove trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
12763
diff
changeset
|
44 ## If @var{curv} is a two-element vector, then the first element is the |
12697 | 45 ## curvature along the x-axis of the patch and the second along y-axis. |
46 ## | |
47 ## If @var{curv} is a scalar, it represents the curvature of the shorter of the | |
48 ## two sides of the rectangle and the curvature of the other side is defined | |
49 ## by | |
50 ## | |
51 ## @example | |
17606 | 52 ## min (pos(1:2)) / max (pos(1:2)) * curv |
12697 | 53 ## @end example |
54 ## | |
19593
446c46af4b42
strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents:
17744
diff
changeset
|
55 ## Additional property/value pairs are passed to the underlying patch command. |
28733
9342688e86b4
Updated property references for text and graphics functions (bug #50247)
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
27923
diff
changeset
|
56 ## The full list of properties is documented at @ref{Patch Properties}. |
19593
446c46af4b42
strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents:
17744
diff
changeset
|
57 ## |
24431
0c6cedafc71e
doc: Use 'axes' rather than 'axis' appropriately in docstrings.
Rik <rik@octave.org>
parents:
23219
diff
changeset
|
58 ## If the first argument @var{hax} is an axes handle, then plot into this axes, |
17122
eaab03308c0b
doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents:
17051
diff
changeset
|
59 ## rather than the current axes returned by @code{gca}. |
eaab03308c0b
doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents:
17051
diff
changeset
|
60 ## |
14001
5f0bb45e615c
doc: Update documentation for functions returning a graphics handle h (Bug #34761)
Rik <octave@nomad.inbox5.com>
parents:
13141
diff
changeset
|
61 ## The optional return value @var{h} is a graphics handle to the created |
5f0bb45e615c
doc: Update documentation for functions returning a graphics handle h (Bug #34761)
Rik <octave@nomad.inbox5.com>
parents:
13141
diff
changeset
|
62 ## rectangle object. |
24932
e178a73af18e
doc: move @seealso lists inside the function doc string block
Mike Miller <mtmiller@octave.org>
parents:
24534
diff
changeset
|
63 ## @seealso{patch, line, cylinder, ellipsoid, sphere} |
12697 | 64 ## @end deftypefn |
65 | |
66 function h = rectangle (varargin) | |
67 | |
68 [hax, varargin] = __plt_get_axis_arg__ ("rectangle", varargin{:}); | |
69 | |
17724
f0bc865db55f
rectangle.m: Fix multiple parenting issues (bug #40214, bug #39813).
Rik <rik@octave.org>
parents:
17606
diff
changeset
|
70 if (isempty (hax)) |
f0bc865db55f
rectangle.m: Fix multiple parenting issues (bug #40214, bug #39813).
Rik <rik@octave.org>
parents:
17606
diff
changeset
|
71 hax = gca (); |
f0bc865db55f
rectangle.m: Fix multiple parenting issues (bug #40214, bug #39813).
Rik <rik@octave.org>
parents:
17606
diff
changeset
|
72 else |
f0bc865db55f
rectangle.m: Fix multiple parenting issues (bug #40214, bug #39813).
Rik <rik@octave.org>
parents:
17606
diff
changeset
|
73 hax = hax(1); |
f0bc865db55f
rectangle.m: Fix multiple parenting issues (bug #40214, bug #39813).
Rik <rik@octave.org>
parents:
17606
diff
changeset
|
74 endif |
f0bc865db55f
rectangle.m: Fix multiple parenting issues (bug #40214, bug #39813).
Rik <rik@octave.org>
parents:
17606
diff
changeset
|
75 |
17211
87ba70043bfc
Don't use ifelse in plot fcns to avoid unnecessary fcn evaluations.
Rik <rik@octave.org>
parents:
17190
diff
changeset
|
76 oldfig = []; |
17301
68bcac3c043a
Correct inversion accidentally introduced in cset 87ba70043bfc.
Rik <rik@octave.org>
parents:
17211
diff
changeset
|
77 if (! isempty (hax)) |
17211
87ba70043bfc
Don't use ifelse in plot fcns to avoid unnecessary fcn evaluations.
Rik <rik@octave.org>
parents:
17190
diff
changeset
|
78 oldfig = get (0, "currentfigure"); |
87ba70043bfc
Don't use ifelse in plot fcns to avoid unnecessary fcn evaluations.
Rik <rik@octave.org>
parents:
17190
diff
changeset
|
79 endif |
17051
3e1b24a2454a
cylinder.m, ellipsoid.m, rectangle.m, sphere.m: Update to use new __plt_get_axis_arg__.
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
14868
diff
changeset
|
80 unwind_protect |
17126
26589abbc78d
Don't pass axis handle unnecessarily from high level to low level plot functions.
Rik <rik@octave.org>
parents:
17122
diff
changeset
|
81 htmp = __rectangle__ (hax, varargin{:}); |
17051
3e1b24a2454a
cylinder.m, ellipsoid.m, rectangle.m, sphere.m: Update to use new __plt_get_axis_arg__.
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
14868
diff
changeset
|
82 unwind_protect_cleanup |
3e1b24a2454a
cylinder.m, ellipsoid.m, rectangle.m, sphere.m: Update to use new __plt_get_axis_arg__.
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
14868
diff
changeset
|
83 if (! isempty (oldfig)) |
3e1b24a2454a
cylinder.m, ellipsoid.m, rectangle.m, sphere.m: Update to use new __plt_get_axis_arg__.
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
14868
diff
changeset
|
84 set (0, "currentfigure", oldfig); |
3e1b24a2454a
cylinder.m, ellipsoid.m, rectangle.m, sphere.m: Update to use new __plt_get_axis_arg__.
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
14868
diff
changeset
|
85 endif |
3e1b24a2454a
cylinder.m, ellipsoid.m, rectangle.m, sphere.m: Update to use new __plt_get_axis_arg__.
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
14868
diff
changeset
|
86 end_unwind_protect |
12697 | 87 |
88 if (nargout > 0) | |
17051
3e1b24a2454a
cylinder.m, ellipsoid.m, rectangle.m, sphere.m: Update to use new __plt_get_axis_arg__.
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
14868
diff
changeset
|
89 h = htmp; |
12697 | 90 endif |
21758
ffad2baa90f7
maint: Use newlines to make code more readable.
Rik <rik@octave.org>
parents:
20852
diff
changeset
|
91 |
12697 | 92 endfunction |
93 | |
94 function hg = __rectangle__ (hax, varargin) | |
95 | |
96 iarg = 1; | |
97 pos = [0, 0, 1, 1]; | |
98 curv2 = [0, 0]; | |
99 ec = [0, 0, 0]; | |
100 fc = "none"; | |
17724
f0bc865db55f
rectangle.m: Fix multiple parenting issues (bug #40214, bug #39813).
Rik <rik@octave.org>
parents:
17606
diff
changeset
|
101 parent = []; |
12697 | 102 |
103 while (iarg < length (varargin)) | |
104 arg = varargin{iarg}; | |
14868
5d3a684236b0
maint: Use Octave coding conventions for cuddling parentheses in scripts directory
Rik <octave@nomad.inbox5.com>
parents:
14245
diff
changeset
|
105 if (ischar (arg)) |
12697 | 106 if (strcmpi (arg, "position")) |
107 pos = varargin{iarg+1}; | |
108 varargin(iarg:iarg+1) = []; | |
17606 | 109 if (! isvector (pos) || numel (pos) != 4) |
28901
3c37ae43996a
maint: Code cleanup associated with varargin checking.
Rik <rik@octave.org>
parents:
28733
diff
changeset
|
110 error ("rectangle: position must be a 4-element vector"); |
12697 | 111 endif |
112 elseif (strcmpi (arg, "curvature")) | |
113 curv2 = varargin{iarg+1}; | |
114 varargin(iarg:iarg+1) = []; | |
19833
9fc020886ae9
maint: Clean up m-files to follow Octave coding conventions.
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
115 if (! isnumeric (curv2) || (numel (curv2) != 1 && numel (curv2) != 2)) |
17606 | 116 error ("rectangle: curvature must be a 2-element vector or a scalar"); |
12697 | 117 endif |
118 if (any (curv2 < 0) || any (curv2 > 1)) | |
119 error ("rectangle: curvature values must be between 0 and 1"); | |
120 endif | |
121 elseif (strcmpi (arg, "edgecolor")) | |
122 ec = varargin{iarg+1}; | |
123 varargin(iarg:iarg+1) = []; | |
124 elseif (strcmpi (arg, "facecolor")) | |
125 fc = varargin{iarg+1}; | |
126 varargin(iarg:iarg+1) = []; | |
17724
f0bc865db55f
rectangle.m: Fix multiple parenting issues (bug #40214, bug #39813).
Rik <rik@octave.org>
parents:
17606
diff
changeset
|
127 elseif (strcmpi (arg, "parent")) |
f0bc865db55f
rectangle.m: Fix multiple parenting issues (bug #40214, bug #39813).
Rik <rik@octave.org>
parents:
17606
diff
changeset
|
128 parent = varargin{iarg+1}; |
f0bc865db55f
rectangle.m: Fix multiple parenting issues (bug #40214, bug #39813).
Rik <rik@octave.org>
parents:
17606
diff
changeset
|
129 varargin(iarg:iarg+1) = []; |
12697 | 130 else |
20735
418ae0cb752f
Replace ++,-- with in-place operators for performance.
Rik <rik@octave.org>
parents:
20714
diff
changeset
|
131 iarg += 1; |
12697 | 132 endif |
133 else | |
20735
418ae0cb752f
Replace ++,-- with in-place operators for performance.
Rik <rik@octave.org>
parents:
20714
diff
changeset
|
134 iarg += 1; |
12697 | 135 endif |
136 endwhile | |
137 | |
138 if (numel (curv2) == 1) | |
17606 | 139 [a, ai] = min (pos(3:4)); |
140 [b, bi] = max (pos(3:4)); | |
12697 | 141 if (ai < bi) |
142 curv = [curv2, curv2 .* a ./ b]; | |
143 else | |
144 curv = [curv2 .* a ./ b, curv2]; | |
145 endif | |
146 else | |
147 curv = curv2; | |
148 endif | |
149 | |
17606 | 150 if (all (curv < 0.01)) |
12697 | 151 ## Special case : no curvature |
152 x = [pos(1), pos(1) + pos(3), pos(1) + pos(3), pos(1), pos(1)]; | |
153 y = [pos(2), pos(2), pos(2) + pos(4), pos(2) + pos(4), pos(2)]; | |
154 else | |
155 p = pi / 2 * [0 : 15] / 15; | |
17606 | 156 c = curv .* pos(3:4) / 2; |
12697 | 157 cx = c(1) * sin (p) - c(1); |
158 cy = c(2) * cos (p) - c(2); | |
159 x = [pos(1) - fliplr(cx), pos(1) + pos(3) + cx, ... | |
160 pos(1) + pos(3) + fliplr(cx), pos(1) - cx, pos(1)]; | |
161 y = [pos(2) - fliplr(cy), pos(2) - cy, pos(2) + pos(4) + fliplr(cy), ... | |
162 pos(2) + pos(4) + cy, pos(2) + c(2)]; | |
163 endif | |
164 | |
17724
f0bc865db55f
rectangle.m: Fix multiple parenting issues (bug #40214, bug #39813).
Rik <rik@octave.org>
parents:
17606
diff
changeset
|
165 if (! isempty (parent)) |
f0bc865db55f
rectangle.m: Fix multiple parenting issues (bug #40214, bug #39813).
Rik <rik@octave.org>
parents:
17606
diff
changeset
|
166 hg = hggroup ("parent", parent); |
f0bc865db55f
rectangle.m: Fix multiple parenting issues (bug #40214, bug #39813).
Rik <rik@octave.org>
parents:
17606
diff
changeset
|
167 else |
f0bc865db55f
rectangle.m: Fix multiple parenting issues (bug #40214, bug #39813).
Rik <rik@octave.org>
parents:
17606
diff
changeset
|
168 hg = hggroup ("parent", hax); |
f0bc865db55f
rectangle.m: Fix multiple parenting issues (bug #40214, bug #39813).
Rik <rik@octave.org>
parents:
17606
diff
changeset
|
169 endif |
12697 | 170 |
17606 | 171 h = patch ("xdata", x(:), "ydata", y(:), "facecolor", fc, "edgecolor", ec, |
12697 | 172 "parent", hg, varargin{:}); |
173 | |
174 addproperty ("curvature", hg, "data", curv2); | |
175 addproperty ("position", hg, "data", pos); | |
176 addproperty ("edgecolor", hg, "patchedgecolor", get (h, "edgecolor")); | |
177 addproperty ("linewidth", hg, "patchlinewidth", get (h, "linewidth")); | |
178 addproperty ("linestyle", hg, "patchlinestyle", get (h, "linestyle")); | |
179 addproperty ("facecolor", hg, "patchfacecolor", get (h, "facecolor")); | |
180 | |
181 addlistener (hg, "curvature", @update_data); | |
182 addlistener (hg, "position", @update_data); | |
183 addlistener (hg, "edgecolor", @update_props); | |
184 addlistener (hg, "linewidth", @update_props); | |
185 addlistener (hg, "linestyle", @update_props); | |
186 addlistener (hg, "facecolor", @update_props); | |
21758
ffad2baa90f7
maint: Use newlines to make code more readable.
Rik <rik@octave.org>
parents:
20852
diff
changeset
|
187 |
12697 | 188 endfunction |
189 | |
17606 | 190 function update_data (h, ~) |
12697 | 191 persistent recursion = false; |
192 | |
193 ## Don't allow recursion | |
17606 | 194 if (! recursion) |
12697 | 195 unwind_protect |
196 recursion = true; | |
197 | |
198 kids = get (h, "children"); | |
199 pos = get (h, "position"); | |
200 curv2 = get (h, "curvature"); | |
201 | |
202 if (numel (curv2) == 1) | |
17606 | 203 [a, ai] = min (pos(3:4)); |
204 [b, bi] = max (pos(3:4)); | |
12697 | 205 if (ai < bi) |
206 curv = [curv2, curv2 .* a ./ b]; | |
207 else | |
208 curv = [curv2 .* a ./ b, curv2]; | |
209 endif | |
210 else | |
211 curv = curv2; | |
212 endif | |
213 | |
17606 | 214 if (all (curv < 0.01)) |
12697 | 215 ## Special case : no curvature |
216 x = [pos(1), pos(1) + pos(3), pos(1) + pos(3), pos(1), pos(1)]; | |
217 y = [pos(2), pos(2), pos(2) + pos(4), pos(2) + pos(4), pos(2)]; | |
218 else | |
219 p = pi / 2 * [0 : 15] / 15; | |
17606 | 220 c = curv .* pos(3:4) / 2; |
12697 | 221 cx = c(1) * sin (p) - c(1); |
222 cy = c(2) * cos (p) - c(2); | |
223 x = [pos(1) - fliplr(cx), pos(1) + pos(3) + cx, ... | |
224 pos(1) + pos(3) + fliplr(cx), pos(1) - cx, pos(1)]; | |
225 y = [pos(2) - fliplr(cy), pos(2) - cy, pos(2) + pos(4) + fliplr(cy), ... | |
226 pos(2) + pos(4) + cy, pos(2) + c(2)]; | |
227 endif | |
228 | |
229 set (kids, "xdata", x, "ydata", y); | |
230 unwind_protect_cleanup | |
231 recursion = false; | |
232 end_unwind_protect | |
233 endif | |
21758
ffad2baa90f7
maint: Use newlines to make code more readable.
Rik <rik@octave.org>
parents:
20852
diff
changeset
|
234 |
12697 | 235 endfunction |
236 | |
17606 | 237 function update_props (h, ~) |
12697 | 238 kids = get (h, "children"); |
17606 | 239 set (kids, {"edgecolor", "linewidth", "linestyle", "facecolor"}, |
240 get (h, {"edgecolor", "linewidth", "linestyle", "facecolor"})); | |
12697 | 241 endfunction |
242 | |
12698
fb93b94dfc82
Add rectangle to new functions list in NEWS.
Rik <octave@nomad.inbox5.com>
parents:
12697
diff
changeset
|
243 |
12697 | 244 %!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
|
245 %! clf; |
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
246 %! axis equal; |
22302
1c4cd12987f5
Use Octave syntax in graphics demos.
Rik <rik@octave.org>
parents:
21758
diff
changeset
|
247 %! rectangle ("Position", [0.05, 0.05, 0.9, 0.9], "Curvature", [0.5, 0.5]); |
1c4cd12987f5
Use Octave syntax in graphics demos.
Rik <rik@octave.org>
parents:
21758
diff
changeset
|
248 %! title ("rectangle() with corners curved"); |
12697 | 249 |
250 %!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
|
251 %! clf; |
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
252 %! axis equal; |
22302
1c4cd12987f5
Use Octave syntax in graphics demos.
Rik <rik@octave.org>
parents:
21758
diff
changeset
|
253 %! rectangle ("Position", [0.05, 0.05, 0.9, 0.4], "Curvature", 1.0); |
1c4cd12987f5
Use Octave syntax in graphics demos.
Rik <rik@octave.org>
parents:
21758
diff
changeset
|
254 %! title ("rectangle() with sides as complete arcs"); |
12697 | 255 |
256 %!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
|
257 %! clf; |
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
258 %! axis equal; |
22302
1c4cd12987f5
Use Octave syntax in graphics demos.
Rik <rik@octave.org>
parents:
21758
diff
changeset
|
259 %! h = rectangle ("Position", [0.05, 0.05, 0.9, 0.4], "Curvature", 1.0); |
1c4cd12987f5
Use Octave syntax in graphics demos.
Rik <rik@octave.org>
parents:
21758
diff
changeset
|
260 %! set (h, "FaceColor", [0, 1, 0]); |
1c4cd12987f5
Use Octave syntax in graphics demos.
Rik <rik@octave.org>
parents:
21758
diff
changeset
|
261 %! title ("rectangle() with FaceColor = green"); |