Mercurial > octave
annotate scripts/plot/draw/area.m @ 30564:796f54d4ddbf stable
update Octave Project Developers copyright for the new year
In files that have the "Octave Project Developers" copyright notice,
update for 2021.
In all .txi and .texi files except gpl.txi and gpl.texi in the
doc/liboctave and doc/interpreter directories, change the copyright
to "Octave Project Developers", the same as used for other source
files. Update copyright notices for 2022 (not done since 2019). For
gpl.txi and gpl.texi, change the copyright notice to be "Free Software
Foundation, Inc." and leave the date at 2007 only because this file
only contains the text of the GPL, not anything created by the Octave
Project Developers.
Add Paul Thomas to contributors.in.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Tue, 28 Dec 2021 18:22:40 -0500 |
parents | d3a02b27fa6a |
children | 597f3ee61a48 |
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 ## |
30564
796f54d4ddbf
update Octave Project Developers copyright for the new year
John W. Eaton <jwe@octave.org>
parents:
29670
diff
changeset
|
3 ## Copyright (C) 2007-2022 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/>. |
7146 | 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 |
7146 | 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:
22367
diff
changeset
|
13 ## (at your option) any later version. |
7146 | 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:
22367
diff
changeset
|
17 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22367
diff
changeset
|
18 ## GNU General Public License for more details. |
7146 | 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 ######################################################################## |
7146 | 25 |
26 ## -*- texinfo -*- | |
20852
516bb87ea72e
2015 Code Sprint: remove class of function from docstring for all m-files.
Rik <rik@octave.org>
parents:
20173
diff
changeset
|
27 ## @deftypefn {} {} area (@var{y}) |
516bb87ea72e
2015 Code Sprint: remove class of function from docstring for all m-files.
Rik <rik@octave.org>
parents:
20173
diff
changeset
|
28 ## @deftypefnx {} {} area (@var{x}, @var{y}) |
516bb87ea72e
2015 Code Sprint: remove class of function from docstring for all m-files.
Rik <rik@octave.org>
parents:
20173
diff
changeset
|
29 ## @deftypefnx {} {} area (@dots{}, @var{lvl}) |
516bb87ea72e
2015 Code Sprint: remove class of function from docstring for all m-files.
Rik <rik@octave.org>
parents:
20173
diff
changeset
|
30 ## @deftypefnx {} {} area (@dots{}, @var{prop}, @var{val}, @dots{}) |
516bb87ea72e
2015 Code Sprint: remove class of function from docstring for all m-files.
Rik <rik@octave.org>
parents:
20173
diff
changeset
|
31 ## @deftypefnx {} {} area (@var{hax}, @dots{}) |
516bb87ea72e
2015 Code Sprint: remove class of function from docstring for all m-files.
Rik <rik@octave.org>
parents:
20173
diff
changeset
|
32 ## @deftypefnx {} {@var{h} =} area (@dots{}) |
17122
eaab03308c0b
doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents:
17061
diff
changeset
|
33 ## Area plot of the columns of @var{y}. |
eaab03308c0b
doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents:
17061
diff
changeset
|
34 ## |
20173
777f26aa8e3e
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19833
diff
changeset
|
35 ## This plot shows the contributions of each column value to the row sum. |
777f26aa8e3e
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19833
diff
changeset
|
36 ## It is functionally similar to @code{plot (@var{x}, cumsum (@var{y}, 2))}, |
17122
eaab03308c0b
doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents:
17061
diff
changeset
|
37 ## except that the area under the curve is shaded. |
7146 | 38 ## |
17122
eaab03308c0b
doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents:
17061
diff
changeset
|
39 ## If the @var{x} argument is omitted it defaults to @code{1:rows (@var{y})}. |
eaab03308c0b
doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents:
17061
diff
changeset
|
40 ## A value @var{lvl} can be defined that determines where the base level of |
eaab03308c0b
doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents:
17061
diff
changeset
|
41 ## the shading under the curve should be defined. The default level is 0. |
7146 | 42 ## |
17122
eaab03308c0b
doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents:
17061
diff
changeset
|
43 ## Additional property/value pairs are passed directly to the underlying patch |
29668
f17b1f0141ed
doc: Grammarcheck documentation ahead of 6.3 release.
Rik <rik@octave.org>
parents:
29358
diff
changeset
|
44 ## object. The full list of properties is documented at |
28733
9342688e86b4
Updated property references for text and graphics functions (bug #50247)
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
27923
diff
changeset
|
45 ## @ref{Patch Properties}. |
14001
5f0bb45e615c
doc: Update documentation for functions returning a graphics handle h (Bug #34761)
Rik <octave@nomad.inbox5.com>
parents:
11587
diff
changeset
|
46 ## |
24431
0c6cedafc71e
doc: Use 'axes' rather than 'axis' appropriately in docstrings.
Rik <rik@octave.org>
parents:
23219
diff
changeset
|
47 ## 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:
17061
diff
changeset
|
48 ## rather than the current axes returned by @code{gca}. |
17061
cae21eadc27b
area.m: Update to use new __plt_get_axis_arg__.
Rik <rik@octave.org>
parents:
17033
diff
changeset
|
49 ## |
14001
5f0bb45e615c
doc: Update documentation for functions returning a graphics handle h (Bug #34761)
Rik <octave@nomad.inbox5.com>
parents:
11587
diff
changeset
|
50 ## The optional return value @var{h} is a graphics handle to the hggroup |
17281
bc924baa2c4e
doc: Add new @qcode macro for code samples which are quoted.
Rik <rik@octave.org>
parents:
17211
diff
changeset
|
51 ## object comprising the area patch objects. The @qcode{"BaseValue"} property |
15566
ab1c6e6d1be6
area.m: Add demos and redo docstring.
Rik <rik@octave.org>
parents:
14872
diff
changeset
|
52 ## of the hggroup can be used to adjust the level where shading begins. |
ab1c6e6d1be6
area.m: Add demos and redo docstring.
Rik <rik@octave.org>
parents:
14872
diff
changeset
|
53 ## |
ab1c6e6d1be6
area.m: Add demos and redo docstring.
Rik <rik@octave.org>
parents:
14872
diff
changeset
|
54 ## Example: Verify identity sin^2 + cos^2 = 1 |
ab1c6e6d1be6
area.m: Add demos and redo docstring.
Rik <rik@octave.org>
parents:
14872
diff
changeset
|
55 ## |
ab1c6e6d1be6
area.m: Add demos and redo docstring.
Rik <rik@octave.org>
parents:
14872
diff
changeset
|
56 ## @example |
16816
12005245b645
doc: Periodic grammarcheck of documentation.
Rik <rik@octave.org>
parents:
15566
diff
changeset
|
57 ## @group |
15566
ab1c6e6d1be6
area.m: Add demos and redo docstring.
Rik <rik@octave.org>
parents:
14872
diff
changeset
|
58 ## t = linspace (0, 2*pi, 100)'; |
18679
a142f35f3cb6
doc: Fix unbalanced parentheses in documentation.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
59 ## y = [sin(t).^2, cos(t).^2]; |
15566
ab1c6e6d1be6
area.m: Add demos and redo docstring.
Rik <rik@octave.org>
parents:
14872
diff
changeset
|
60 ## area (t, y); |
17281
bc924baa2c4e
doc: Add new @qcode macro for code samples which are quoted.
Rik <rik@octave.org>
parents:
17211
diff
changeset
|
61 ## legend ("sin^2", "cos^2", "location", "NorthEastOutside"); |
16816
12005245b645
doc: Periodic grammarcheck of documentation.
Rik <rik@octave.org>
parents:
15566
diff
changeset
|
62 ## @end group |
15566
ab1c6e6d1be6
area.m: Add demos and redo docstring.
Rik <rik@octave.org>
parents:
14872
diff
changeset
|
63 ## @end example |
7146 | 64 ## @seealso{plot, patch} |
65 ## @end deftypefn | |
66 | |
7147 | 67 function h = area (varargin) |
7146 | 68 |
17061
cae21eadc27b
area.m: Update to use new __plt_get_axis_arg__.
Rik <rik@octave.org>
parents:
17033
diff
changeset
|
69 [hax, varargin, nargin] = __plt_get_axis_arg__ ("area", varargin{:}); |
7215 | 70 |
15566
ab1c6e6d1be6
area.m: Add demos and redo docstring.
Rik <rik@octave.org>
parents:
14872
diff
changeset
|
71 if (nargin == 0) |
ab1c6e6d1be6
area.m: Add demos and redo docstring.
Rik <rik@octave.org>
parents:
14872
diff
changeset
|
72 print_usage (); |
ab1c6e6d1be6
area.m: Add demos and redo docstring.
Rik <rik@octave.org>
parents:
14872
diff
changeset
|
73 endif |
ab1c6e6d1be6
area.m: Add demos and redo docstring.
Rik <rik@octave.org>
parents:
14872
diff
changeset
|
74 |
ab1c6e6d1be6
area.m: Add demos and redo docstring.
Rik <rik@octave.org>
parents:
14872
diff
changeset
|
75 x = y = []; |
ab1c6e6d1be6
area.m: Add demos and redo docstring.
Rik <rik@octave.org>
parents:
14872
diff
changeset
|
76 bv = 0; |
17437
cf5a8fccfc63
area.m: Overhaul function to fix color cycling.
Rik <rik@octave.org>
parents:
17336
diff
changeset
|
77 |
cf5a8fccfc63
area.m: Overhaul function to fix color cycling.
Rik <rik@octave.org>
parents:
17336
diff
changeset
|
78 num_numeric = find (cellfun ("isclass", varargin, "char"), 1) - 1; |
cf5a8fccfc63
area.m: Overhaul function to fix color cycling.
Rik <rik@octave.org>
parents:
17336
diff
changeset
|
79 if (isempty (num_numeric)) |
19593
446c46af4b42
strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents:
17744
diff
changeset
|
80 num_numeric = nargin; |
17437
cf5a8fccfc63
area.m: Overhaul function to fix color cycling.
Rik <rik@octave.org>
parents:
17336
diff
changeset
|
81 endif |
cf5a8fccfc63
area.m: Overhaul function to fix color cycling.
Rik <rik@octave.org>
parents:
17336
diff
changeset
|
82 |
cf5a8fccfc63
area.m: Overhaul function to fix color cycling.
Rik <rik@octave.org>
parents:
17336
diff
changeset
|
83 switch (num_numeric) |
cf5a8fccfc63
area.m: Overhaul function to fix color cycling.
Rik <rik@octave.org>
parents:
17336
diff
changeset
|
84 case 1 |
cf5a8fccfc63
area.m: Overhaul function to fix color cycling.
Rik <rik@octave.org>
parents:
17336
diff
changeset
|
85 y = varargin{1}; |
cf5a8fccfc63
area.m: Overhaul function to fix color cycling.
Rik <rik@octave.org>
parents:
17336
diff
changeset
|
86 case 2 |
19593
446c46af4b42
strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents:
17744
diff
changeset
|
87 if (isscalar (varargin{2})) |
17437
cf5a8fccfc63
area.m: Overhaul function to fix color cycling.
Rik <rik@octave.org>
parents:
17336
diff
changeset
|
88 y = varargin{1}; |
cf5a8fccfc63
area.m: Overhaul function to fix color cycling.
Rik <rik@octave.org>
parents:
17336
diff
changeset
|
89 bv = varargin{2}; |
cf5a8fccfc63
area.m: Overhaul function to fix color cycling.
Rik <rik@octave.org>
parents:
17336
diff
changeset
|
90 else |
cf5a8fccfc63
area.m: Overhaul function to fix color cycling.
Rik <rik@octave.org>
parents:
17336
diff
changeset
|
91 x = varargin{1}; |
cf5a8fccfc63
area.m: Overhaul function to fix color cycling.
Rik <rik@octave.org>
parents:
17336
diff
changeset
|
92 y = varargin{2}; |
7146 | 93 endif |
17437
cf5a8fccfc63
area.m: Overhaul function to fix color cycling.
Rik <rik@octave.org>
parents:
17336
diff
changeset
|
94 case 3 |
cf5a8fccfc63
area.m: Overhaul function to fix color cycling.
Rik <rik@octave.org>
parents:
17336
diff
changeset
|
95 x = varargin{1}; |
cf5a8fccfc63
area.m: Overhaul function to fix color cycling.
Rik <rik@octave.org>
parents:
17336
diff
changeset
|
96 y = varargin{2}; |
cf5a8fccfc63
area.m: Overhaul function to fix color cycling.
Rik <rik@octave.org>
parents:
17336
diff
changeset
|
97 bv = varargin{3}; |
cf5a8fccfc63
area.m: Overhaul function to fix color cycling.
Rik <rik@octave.org>
parents:
17336
diff
changeset
|
98 otherwise |
cf5a8fccfc63
area.m: Overhaul function to fix color cycling.
Rik <rik@octave.org>
parents:
17336
diff
changeset
|
99 print_usage (); |
cf5a8fccfc63
area.m: Overhaul function to fix color cycling.
Rik <rik@octave.org>
parents:
17336
diff
changeset
|
100 endswitch |
cf5a8fccfc63
area.m: Overhaul function to fix color cycling.
Rik <rik@octave.org>
parents:
17336
diff
changeset
|
101 |
cf5a8fccfc63
area.m: Overhaul function to fix color cycling.
Rik <rik@octave.org>
parents:
17336
diff
changeset
|
102 if (! isreal (x) || ! isreal (y)) |
cf5a8fccfc63
area.m: Overhaul function to fix color cycling.
Rik <rik@octave.org>
parents:
17336
diff
changeset
|
103 error ("area: X and Y must be real vectors or matrices"); |
7146 | 104 endif |
17437
cf5a8fccfc63
area.m: Overhaul function to fix color cycling.
Rik <rik@octave.org>
parents:
17336
diff
changeset
|
105 if (! isreal (bv) || ! isscalar (bv)) |
cf5a8fccfc63
area.m: Overhaul function to fix color cycling.
Rik <rik@octave.org>
parents:
17336
diff
changeset
|
106 error ("area: LVL must be a real scalar"); |
15566
ab1c6e6d1be6
area.m: Add demos and redo docstring.
Rik <rik@octave.org>
parents:
14872
diff
changeset
|
107 endif |
17437
cf5a8fccfc63
area.m: Overhaul function to fix color cycling.
Rik <rik@octave.org>
parents:
17336
diff
changeset
|
108 |
15566
ab1c6e6d1be6
area.m: Add demos and redo docstring.
Rik <rik@octave.org>
parents:
14872
diff
changeset
|
109 if (isvector (y)) |
ab1c6e6d1be6
area.m: Add demos and redo docstring.
Rik <rik@octave.org>
parents:
14872
diff
changeset
|
110 y = y(:); |
ab1c6e6d1be6
area.m: Add demos and redo docstring.
Rik <rik@octave.org>
parents:
14872
diff
changeset
|
111 endif |
ab1c6e6d1be6
area.m: Add demos and redo docstring.
Rik <rik@octave.org>
parents:
14872
diff
changeset
|
112 if (isempty (x)) |
ab1c6e6d1be6
area.m: Add demos and redo docstring.
Rik <rik@octave.org>
parents:
14872
diff
changeset
|
113 x = repmat ([1:rows(y)]', 1, columns (y)); |
ab1c6e6d1be6
area.m: Add demos and redo docstring.
Rik <rik@octave.org>
parents:
14872
diff
changeset
|
114 elseif (isvector (x)) |
17061
cae21eadc27b
area.m: Update to use new __plt_get_axis_arg__.
Rik <rik@octave.org>
parents:
17033
diff
changeset
|
115 x = repmat (x(:), 1, columns (y)); |
15566
ab1c6e6d1be6
area.m: Add demos and redo docstring.
Rik <rik@octave.org>
parents:
14872
diff
changeset
|
116 endif |
ab1c6e6d1be6
area.m: Add demos and redo docstring.
Rik <rik@octave.org>
parents:
14872
diff
changeset
|
117 |
17211
87ba70043bfc
Don't use ifelse in plot fcns to avoid unnecessary fcn evaluations.
Rik <rik@octave.org>
parents:
17190
diff
changeset
|
118 oldfig = []; |
17301
68bcac3c043a
Correct inversion accidentally introduced in cset 87ba70043bfc.
Rik <rik@octave.org>
parents:
17281
diff
changeset
|
119 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
|
120 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
|
121 endif |
15566
ab1c6e6d1be6
area.m: Add demos and redo docstring.
Rik <rik@octave.org>
parents:
14872
diff
changeset
|
122 unwind_protect |
17061
cae21eadc27b
area.m: Update to use new __plt_get_axis_arg__.
Rik <rik@octave.org>
parents:
17033
diff
changeset
|
123 hax = newplot (hax); |
17437
cf5a8fccfc63
area.m: Overhaul function to fix color cycling.
Rik <rik@octave.org>
parents:
17336
diff
changeset
|
124 htmp = __area__ (hax, x, y, bv, varargin{num_numeric+1:end}); |
22366
837df5db5710
Make graphic functions visually compatible w/Matlab.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
125 |
22367
459545bc9019
Use ishold () rather than ishold (hax) for performance.
Rik <rik@octave.org>
parents:
22366
diff
changeset
|
126 if (! ishold ()) |
22366
837df5db5710
Make graphic functions visually compatible w/Matlab.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
127 set (hax, "box", "on"); |
837df5db5710
Make graphic functions visually compatible w/Matlab.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
128 endif |
837df5db5710
Make graphic functions visually compatible w/Matlab.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
129 |
15566
ab1c6e6d1be6
area.m: Add demos and redo docstring.
Rik <rik@octave.org>
parents:
14872
diff
changeset
|
130 unwind_protect_cleanup |
17061
cae21eadc27b
area.m: Update to use new __plt_get_axis_arg__.
Rik <rik@octave.org>
parents:
17033
diff
changeset
|
131 if (! isempty (oldfig)) |
cae21eadc27b
area.m: Update to use new __plt_get_axis_arg__.
Rik <rik@octave.org>
parents:
17033
diff
changeset
|
132 set (0, "currentfigure", oldfig); |
cae21eadc27b
area.m: Update to use new __plt_get_axis_arg__.
Rik <rik@octave.org>
parents:
17033
diff
changeset
|
133 endif |
15566
ab1c6e6d1be6
area.m: Add demos and redo docstring.
Rik <rik@octave.org>
parents:
14872
diff
changeset
|
134 end_unwind_protect |
ab1c6e6d1be6
area.m: Add demos and redo docstring.
Rik <rik@octave.org>
parents:
14872
diff
changeset
|
135 |
ab1c6e6d1be6
area.m: Add demos and redo docstring.
Rik <rik@octave.org>
parents:
14872
diff
changeset
|
136 if (nargout > 0) |
17061
cae21eadc27b
area.m: Update to use new __plt_get_axis_arg__.
Rik <rik@octave.org>
parents:
17033
diff
changeset
|
137 h = htmp; |
15566
ab1c6e6d1be6
area.m: Add demos and redo docstring.
Rik <rik@octave.org>
parents:
14872
diff
changeset
|
138 endif |
7146 | 139 |
140 endfunction | |
9896
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
9245
diff
changeset
|
141 |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
9245
diff
changeset
|
142 function retval = __area__ (ax, x, y, bv, varargin) |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
9245
diff
changeset
|
143 |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
9245
diff
changeset
|
144 y0 = bv * ones (1, rows (y)); |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
9245
diff
changeset
|
145 y0 = zeros (1, rows (y)); |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
9245
diff
changeset
|
146 retval = []; |
26268
6dd232798997
maint: Remove useless ';' from end of for, if, while, etc. statements.
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
147 for i = 1: columns (y) |
17437
cf5a8fccfc63
area.m: Overhaul function to fix color cycling.
Rik <rik@octave.org>
parents:
17336
diff
changeset
|
148 |
cf5a8fccfc63
area.m: Overhaul function to fix color cycling.
Rik <rik@octave.org>
parents:
17336
diff
changeset
|
149 lc = __next_line_color__ (); |
cf5a8fccfc63
area.m: Overhaul function to fix color cycling.
Rik <rik@octave.org>
parents:
17336
diff
changeset
|
150 |
cf5a8fccfc63
area.m: Overhaul function to fix color cycling.
Rik <rik@octave.org>
parents:
17336
diff
changeset
|
151 ## Must occur after __next_line_color__ in order to work correctly. |
9896
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
9245
diff
changeset
|
152 hg = hggroup (); |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
9245
diff
changeset
|
153 retval = [retval; hg]; |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
9245
diff
changeset
|
154 args = __add_datasource__ ("area", hg, {"x", "y"}, varargin{:}); |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
9245
diff
changeset
|
155 |
17437
cf5a8fccfc63
area.m: Overhaul function to fix color cycling.
Rik <rik@octave.org>
parents:
17336
diff
changeset
|
156 x1 = x(:, 1)'; |
cf5a8fccfc63
area.m: Overhaul function to fix color cycling.
Rik <rik@octave.org>
parents:
17336
diff
changeset
|
157 y1 = y(:, i)'; |
9896
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
9245
diff
changeset
|
158 addproperty ("xdata", hg, "data", x1); |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
9245
diff
changeset
|
159 addproperty ("ydata", hg, "data", y1); |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
9245
diff
changeset
|
160 |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
9245
diff
changeset
|
161 addlistener (hg, "xdata", @update_data); |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
9245
diff
changeset
|
162 addlistener (hg, "ydata", @update_data); |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
9245
diff
changeset
|
163 |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
9245
diff
changeset
|
164 if (i == 1) |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
9245
diff
changeset
|
165 h = patch (ax, [x1(1), x1, fliplr(x1)], [bv, y1, bv*ones(1, length(y1))], |
17437
cf5a8fccfc63
area.m: Overhaul function to fix color cycling.
Rik <rik@octave.org>
parents:
17336
diff
changeset
|
166 lc, "parent", hg); |
9896
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
9245
diff
changeset
|
167 else |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
9245
diff
changeset
|
168 y1 = y0 + y1; |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
9245
diff
changeset
|
169 h = patch (ax, [x1(1), x1, fliplr(x1)], [y0(1), y1, fliplr(y0)], |
17437
cf5a8fccfc63
area.m: Overhaul function to fix color cycling.
Rik <rik@octave.org>
parents:
17336
diff
changeset
|
170 lc, "parent", hg); |
9896
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
9245
diff
changeset
|
171 endif |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
9245
diff
changeset
|
172 |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
9245
diff
changeset
|
173 y0 = y1; |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
9245
diff
changeset
|
174 |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
9245
diff
changeset
|
175 addproperty ("basevalue", hg, "data", bv); |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
176 addlistener (hg, "basevalue", @move_baseline); |
9896
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
9245
diff
changeset
|
177 |
24794
1cacfebaed3e
area.m: Implement EdgeAlpha and FaceAlpha properties (bug #53214).
Rik <rik@octave.org>
parents:
24534
diff
changeset
|
178 addproperty ("edgealpha", hg, "patchedgealpha", get (h, "edgealpha")); |
9896
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
9245
diff
changeset
|
179 addproperty ("edgecolor", hg, "patchedgecolor", get (h, "edgecolor")); |
24794
1cacfebaed3e
area.m: Implement EdgeAlpha and FaceAlpha properties (bug #53214).
Rik <rik@octave.org>
parents:
24534
diff
changeset
|
180 addproperty ("facealpha", hg, "patchfacealpha", get (h, "facealpha")); |
17437
cf5a8fccfc63
area.m: Overhaul function to fix color cycling.
Rik <rik@octave.org>
parents:
17336
diff
changeset
|
181 addproperty ("facecolor", hg, "patchfacecolor", get (h, "facecolor")); |
9896
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
9245
diff
changeset
|
182 addproperty ("linestyle", hg, "patchlinestyle", get (h, "linestyle")); |
17437
cf5a8fccfc63
area.m: Overhaul function to fix color cycling.
Rik <rik@octave.org>
parents:
17336
diff
changeset
|
183 addproperty ("linewidth", hg, "patchlinewidth", get (h, "linewidth")); |
9896
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
9245
diff
changeset
|
184 |
24794
1cacfebaed3e
area.m: Implement EdgeAlpha and FaceAlpha properties (bug #53214).
Rik <rik@octave.org>
parents:
24534
diff
changeset
|
185 addlistener (hg, "edgealpha", {@update_prop, "edgealpha"}); |
1cacfebaed3e
area.m: Implement EdgeAlpha and FaceAlpha properties (bug #53214).
Rik <rik@octave.org>
parents:
24534
diff
changeset
|
186 addlistener (hg, "edgecolor", {@update_prop, "edgecolor"}); |
1cacfebaed3e
area.m: Implement EdgeAlpha and FaceAlpha properties (bug #53214).
Rik <rik@octave.org>
parents:
24534
diff
changeset
|
187 addlistener (hg, "facealpha", {@update_prop, "facealpha"}); |
1cacfebaed3e
area.m: Implement EdgeAlpha and FaceAlpha properties (bug #53214).
Rik <rik@octave.org>
parents:
24534
diff
changeset
|
188 addlistener (hg, "facecolor", {@update_prop, "facecolor"}); |
1cacfebaed3e
area.m: Implement EdgeAlpha and FaceAlpha properties (bug #53214).
Rik <rik@octave.org>
parents:
24534
diff
changeset
|
189 addlistener (hg, "linestyle", {@update_prop, "linestyle"}); |
1cacfebaed3e
area.m: Implement EdgeAlpha and FaceAlpha properties (bug #53214).
Rik <rik@octave.org>
parents:
24534
diff
changeset
|
190 addlistener (hg, "linewidth", {@update_prop, "linewidth"}); |
9896
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
9245
diff
changeset
|
191 |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
9245
diff
changeset
|
192 addproperty ("areagroup", hg, "data"); |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
9245
diff
changeset
|
193 set (retval, "areagroup", retval); |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
9245
diff
changeset
|
194 |
24794
1cacfebaed3e
area.m: Implement EdgeAlpha and FaceAlpha properties (bug #53214).
Rik <rik@octave.org>
parents:
24534
diff
changeset
|
195 ## Deprecated Matlab property which Octave does not implement. |
17527
76614e624818
Add "HitTestArea" property to certain hggroups for Matlab compatibility
Rik <rik@octave.org>
parents:
17437
diff
changeset
|
196 addproperty ("hittestarea", hg, "radio", "on|{off}", "off"); |
76614e624818
Add "HitTestArea" property to certain hggroups for Matlab compatibility
Rik <rik@octave.org>
parents:
17437
diff
changeset
|
197 |
9896
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
9245
diff
changeset
|
198 if (! isempty (args)) |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
9245
diff
changeset
|
199 set (hg, args{:}); |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
9245
diff
changeset
|
200 endif |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
9245
diff
changeset
|
201 endfor |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
9245
diff
changeset
|
202 |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
9245
diff
changeset
|
203 endfunction |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
9245
diff
changeset
|
204 |
24794
1cacfebaed3e
area.m: Implement EdgeAlpha and FaceAlpha properties (bug #53214).
Rik <rik@octave.org>
parents:
24534
diff
changeset
|
205 function update_prop (h, ~, prop) |
9896
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
9245
diff
changeset
|
206 kids = get (h, "children"); |
24794
1cacfebaed3e
area.m: Implement EdgeAlpha and FaceAlpha properties (bug #53214).
Rik <rik@octave.org>
parents:
24534
diff
changeset
|
207 set (kids, prop, get (h, prop)); |
9896
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
9245
diff
changeset
|
208 endfunction |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
9245
diff
changeset
|
209 |
28595
4deb794d85e2
Resolve further number of argument mismatch in graphics callbacks (bug #58821)
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
210 function move_baseline (h, ~) |
9896
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
9245
diff
changeset
|
211 persistent recursion = false; |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
9245
diff
changeset
|
212 |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
9245
diff
changeset
|
213 ## Don't allow recursion |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
9245
diff
changeset
|
214 if (! recursion) |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
9245
diff
changeset
|
215 unwind_protect |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
9245
diff
changeset
|
216 recursion = true; |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
9245
diff
changeset
|
217 hlist = get (h, "areagroup"); |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
9245
diff
changeset
|
218 b0 = get (h, "basevalue"); |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
9245
diff
changeset
|
219 |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
9245
diff
changeset
|
220 for hh = hlist(:)' |
10549 | 221 if (hh != h) |
222 b1 = get (hh, "basevalue"); | |
223 if (b1 != b0) | |
224 set (hh, "basevalue", b0); | |
225 endif | |
226 endif | |
9896
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
9245
diff
changeset
|
227 endfor |
28595
4deb794d85e2
Resolve further number of argument mismatch in graphics callbacks (bug #58821)
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
228 update_data (h, []); |
9896
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
9245
diff
changeset
|
229 unwind_protect_cleanup |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
9245
diff
changeset
|
230 recursion = false; |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
9245
diff
changeset
|
231 end_unwind_protect |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
9245
diff
changeset
|
232 endif |
21758
ffad2baa90f7
maint: Use newlines to make code more readable.
Rik <rik@octave.org>
parents:
21580
diff
changeset
|
233 |
9896
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
9245
diff
changeset
|
234 endfunction |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
9245
diff
changeset
|
235 |
28595
4deb794d85e2
Resolve further number of argument mismatch in graphics callbacks (bug #58821)
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
236 function update_data (h, ~) |
21758
ffad2baa90f7
maint: Use newlines to make code more readable.
Rik <rik@octave.org>
parents:
21580
diff
changeset
|
237 |
9896
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
9245
diff
changeset
|
238 hlist = get (h, "areagroup"); |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
9245
diff
changeset
|
239 bv = get (h, "basevalue"); |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
9245
diff
changeset
|
240 for i = 1 : length (hlist) |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
9245
diff
changeset
|
241 hh = hlist(i); |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
9245
diff
changeset
|
242 x1 = get (hh, "xdata")(:); |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
9245
diff
changeset
|
243 y1 = get (hh, "ydata")(:); |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
9245
diff
changeset
|
244 |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
9245
diff
changeset
|
245 set (get (hh, "children"), "xdata", [x1(1); x1; flipud(x1)]); |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
9245
diff
changeset
|
246 if (i == 1) |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
9245
diff
changeset
|
247 set (get (hh, "children"), "ydata", [bv; y1; bv*ones(length(y1), 1)]); |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
9245
diff
changeset
|
248 else |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
9245
diff
changeset
|
249 y1 = y0 + y1; |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
9245
diff
changeset
|
250 set (get (hh, "children"), "ydata", [y0(1); y1; flipud(y0)]); |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
251 endif |
9896
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
9245
diff
changeset
|
252 |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
9245
diff
changeset
|
253 y0 = y1; |
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
9245
diff
changeset
|
254 endfor |
21758
ffad2baa90f7
maint: Use newlines to make code more readable.
Rik <rik@octave.org>
parents:
21580
diff
changeset
|
255 |
9896
1aeb39118764
convert some plot functions to subfunctions or make some them private
John W. Eaton <jwe@octave.org>
parents:
9245
diff
changeset
|
256 endfunction |
15566
ab1c6e6d1be6
area.m: Add demos and redo docstring.
Rik <rik@octave.org>
parents:
14872
diff
changeset
|
257 |
ab1c6e6d1be6
area.m: Add demos and redo docstring.
Rik <rik@octave.org>
parents:
14872
diff
changeset
|
258 |
ab1c6e6d1be6
area.m: Add demos and redo docstring.
Rik <rik@octave.org>
parents:
14872
diff
changeset
|
259 %!demo |
17336
b81b9d079515
Use '##' for comments which stand alone on a line.
Rik <rik@octave.org>
parents:
17301
diff
changeset
|
260 %! ## Verify identity sin^2 + cos^2 = 1 |
15566
ab1c6e6d1be6
area.m: Add demos and redo docstring.
Rik <rik@octave.org>
parents:
14872
diff
changeset
|
261 %! clf; |
22366
837df5db5710
Make graphic functions visually compatible w/Matlab.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
262 %! t = linspace (0, 2*pi, 100)'; |
15566
ab1c6e6d1be6
area.m: Add demos and redo docstring.
Rik <rik@octave.org>
parents:
14872
diff
changeset
|
263 %! y = [sin(t).^2, cos(t).^2]; |
ab1c6e6d1be6
area.m: Add demos and redo docstring.
Rik <rik@octave.org>
parents:
14872
diff
changeset
|
264 %! area (t, y); |
16917
4bbc4b703fe4
area.m: tight axis limits for demo.
Ben Abbott <bpabbott@mac.com>
parents:
16816
diff
changeset
|
265 %! axis tight |
22302
1c4cd12987f5
Use Octave syntax in graphics demos.
Rik <rik@octave.org>
parents:
21758
diff
changeset
|
266 %! legend ("sin^2", "cos^2", "location", "NorthEastOutside"); |
1c4cd12987f5
Use Octave syntax in graphics demos.
Rik <rik@octave.org>
parents:
21758
diff
changeset
|
267 %! title ("area() plot"); |
15566
ab1c6e6d1be6
area.m: Add demos and redo docstring.
Rik <rik@octave.org>
parents:
14872
diff
changeset
|
268 |
ab1c6e6d1be6
area.m: Add demos and redo docstring.
Rik <rik@octave.org>
parents:
14872
diff
changeset
|
269 %!demo |
17336
b81b9d079515
Use '##' for comments which stand alone on a line.
Rik <rik@octave.org>
parents:
17301
diff
changeset
|
270 %! ## Show effects of setting BaseValue |
15566
ab1c6e6d1be6
area.m: Add demos and redo docstring.
Rik <rik@octave.org>
parents:
14872
diff
changeset
|
271 %! clf; |
22366
837df5db5710
Make graphic functions visually compatible w/Matlab.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
272 %! x = [-2:0.1:2]'; |
15566
ab1c6e6d1be6
area.m: Add demos and redo docstring.
Rik <rik@octave.org>
parents:
14872
diff
changeset
|
273 %! y = x.^2 - 1; |
ab1c6e6d1be6
area.m: Add demos and redo docstring.
Rik <rik@octave.org>
parents:
14872
diff
changeset
|
274 %! subplot (1, 2, 1) |
22302
1c4cd12987f5
Use Octave syntax in graphics demos.
Rik <rik@octave.org>
parents:
21758
diff
changeset
|
275 %! area (x, y); |
1c4cd12987f5
Use Octave syntax in graphics demos.
Rik <rik@octave.org>
parents:
21758
diff
changeset
|
276 %! title ({"Parabola y = x^2 -1";"BaseValue = 0"}); |
15566
ab1c6e6d1be6
area.m: Add demos and redo docstring.
Rik <rik@octave.org>
parents:
14872
diff
changeset
|
277 %! subplot (1, 2, 2) |
22302
1c4cd12987f5
Use Octave syntax in graphics demos.
Rik <rik@octave.org>
parents:
21758
diff
changeset
|
278 %! h = area (x, y); |
1c4cd12987f5
Use Octave syntax in graphics demos.
Rik <rik@octave.org>
parents:
21758
diff
changeset
|
279 %! set (h, "basevalue", -1); |
1c4cd12987f5
Use Octave syntax in graphics demos.
Rik <rik@octave.org>
parents:
21758
diff
changeset
|
280 %! title ({"Parabola y = x^2 -1";"BaseValue = -1"}); |
15566
ab1c6e6d1be6
area.m: Add demos and redo docstring.
Rik <rik@octave.org>
parents:
14872
diff
changeset
|
281 |
17033
02679492b0c6
Add demo to area.m to demonstrate "ydata" updater.
Ben Abbott <bpabbott@mac.com>
parents:
16917
diff
changeset
|
282 %!demo |
17190
df4c4b7708a4
Add titles and clean-up plotting %!demos.
Rik <rik@octave.org>
parents:
17122
diff
changeset
|
283 %! clf; |
17033
02679492b0c6
Add demo to area.m to demonstrate "ydata" updater.
Ben Abbott <bpabbott@mac.com>
parents:
16917
diff
changeset
|
284 %! x = 0:10; |
02679492b0c6
Add demo to area.m to demonstrate "ydata" updater.
Ben Abbott <bpabbott@mac.com>
parents:
16917
diff
changeset
|
285 %! y = rand (size (x)); |
02679492b0c6
Add demo to area.m to demonstrate "ydata" updater.
Ben Abbott <bpabbott@mac.com>
parents:
16917
diff
changeset
|
286 %! h = area (x, y); |
22302
1c4cd12987f5
Use Octave syntax in graphics demos.
Rik <rik@octave.org>
parents:
21758
diff
changeset
|
287 %! set (h, "ydata", sort (get (h, "ydata"))); |
1c4cd12987f5
Use Octave syntax in graphics demos.
Rik <rik@octave.org>
parents:
21758
diff
changeset
|
288 %! title ("area() plot of sorted data"); |
17336
b81b9d079515
Use '##' for comments which stand alone on a line.
Rik <rik@octave.org>
parents:
17301
diff
changeset
|
289 |
19833
9fc020886ae9
maint: Clean up m-files to follow Octave coding conventions.
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
290 ## Test input validation |
28896
90fea9cc9caa
test: Add expected error message <Invalid call> to BIST tests for nargin.
Rik <rik@octave.org>
parents:
28753
diff
changeset
|
291 %!error <Invalid call> area () |
17437
cf5a8fccfc63
area.m: Overhaul function to fix color cycling.
Rik <rik@octave.org>
parents:
17336
diff
changeset
|
292 %!error area (1,2,3,4) |
cf5a8fccfc63
area.m: Overhaul function to fix color cycling.
Rik <rik@octave.org>
parents:
17336
diff
changeset
|
293 %!error <X and Y must be real vectors or matrices> area ({1}) |
cf5a8fccfc63
area.m: Overhaul function to fix color cycling.
Rik <rik@octave.org>
parents:
17336
diff
changeset
|
294 %!error <X and Y must be real vectors or matrices> area (1+i) |
cf5a8fccfc63
area.m: Overhaul function to fix color cycling.
Rik <rik@octave.org>
parents:
17336
diff
changeset
|
295 %!error <X and Y must be real vectors or matrices> area (1:2, {1, 2}) |
cf5a8fccfc63
area.m: Overhaul function to fix color cycling.
Rik <rik@octave.org>
parents:
17336
diff
changeset
|
296 %!error <X and Y must be real vectors or matrices> area (1:2, [1 1+i]) |
cf5a8fccfc63
area.m: Overhaul function to fix color cycling.
Rik <rik@octave.org>
parents:
17336
diff
changeset
|
297 %!error <LVL must be a real scalar> area (1, i) |
cf5a8fccfc63
area.m: Overhaul function to fix color cycling.
Rik <rik@octave.org>
parents:
17336
diff
changeset
|
298 %!error <LVL must be a real scalar> area (1, 2, ones (2,2)) |