annotate scripts/plot/area.m @ 11885:3342d1a7c4c9 release-3-0-x

spelling corrections Here is a patch with some spelling corrections to the manual. changeset: 8308:aeaf884ea9af user: Brian Gough <bjg@gnu.org> date: Fri Nov 07 09:26:17 2008 -0500 summary: [docs] assoicated => associated
author Brian Gough<bjg@network-theory.co.uk>
date Thu, 20 Nov 2008 08:39:44 +0100
parents dd88d61d443f
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
7146
c7e5e638a8d0 [project @ 2007-11-09 17:49:44 by jwe]
jwe
parents:
diff changeset
1 ## Copyright (C) 2007 Michael Goffioul
c7e5e638a8d0 [project @ 2007-11-09 17:49:44 by jwe]
jwe
parents:
diff changeset
2 ##
c7e5e638a8d0 [project @ 2007-11-09 17:49:44 by jwe]
jwe
parents:
diff changeset
3 ## This file is part of Octave.
c7e5e638a8d0 [project @ 2007-11-09 17:49:44 by jwe]
jwe
parents:
diff changeset
4 ##
c7e5e638a8d0 [project @ 2007-11-09 17:49:44 by jwe]
jwe
parents:
diff changeset
5 ## Octave is free software; you can redistribute it and/or modify it
c7e5e638a8d0 [project @ 2007-11-09 17:49:44 by jwe]
jwe
parents:
diff changeset
6 ## under the terms of the GNU General Public License as published by
c7e5e638a8d0 [project @ 2007-11-09 17:49:44 by jwe]
jwe
parents:
diff changeset
7 ## the Free Software Foundation; either version 3 of the License, or (at
c7e5e638a8d0 [project @ 2007-11-09 17:49:44 by jwe]
jwe
parents:
diff changeset
8 ## your option) any later version.
c7e5e638a8d0 [project @ 2007-11-09 17:49:44 by jwe]
jwe
parents:
diff changeset
9 ##
c7e5e638a8d0 [project @ 2007-11-09 17:49:44 by jwe]
jwe
parents:
diff changeset
10 ## Octave is distributed in the hope that it will be useful, but
c7e5e638a8d0 [project @ 2007-11-09 17:49:44 by jwe]
jwe
parents:
diff changeset
11 ## WITHOUT ANY WARRANTY; without even the implied warranty of
c7e5e638a8d0 [project @ 2007-11-09 17:49:44 by jwe]
jwe
parents:
diff changeset
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
c7e5e638a8d0 [project @ 2007-11-09 17:49:44 by jwe]
jwe
parents:
diff changeset
13 ## General Public License for more details.
c7e5e638a8d0 [project @ 2007-11-09 17:49:44 by jwe]
jwe
parents:
diff changeset
14 ##
c7e5e638a8d0 [project @ 2007-11-09 17:49:44 by jwe]
jwe
parents:
diff changeset
15 ## You should have received a copy of the GNU General Public License
c7e5e638a8d0 [project @ 2007-11-09 17:49:44 by jwe]
jwe
parents:
diff changeset
16 ## along with Octave; see the file COPYING. If not, see
c7e5e638a8d0 [project @ 2007-11-09 17:49:44 by jwe]
jwe
parents:
diff changeset
17 ## <http://www.gnu.org/licenses/>.
c7e5e638a8d0 [project @ 2007-11-09 17:49:44 by jwe]
jwe
parents:
diff changeset
18
c7e5e638a8d0 [project @ 2007-11-09 17:49:44 by jwe]
jwe
parents:
diff changeset
19 ## -*- texinfo -*-
c7e5e638a8d0 [project @ 2007-11-09 17:49:44 by jwe]
jwe
parents:
diff changeset
20 ## @deftypefn {Function File} {} area (@var{x}, @var{y})
c7e5e638a8d0 [project @ 2007-11-09 17:49:44 by jwe]
jwe
parents:
diff changeset
21 ## @deftypefnx {Function File} {} area (@var{x}, @var{y}, @var{lvl})
c7e5e638a8d0 [project @ 2007-11-09 17:49:44 by jwe]
jwe
parents:
diff changeset
22 ## @deftypefnx {Function File} {} area (@dots{}, @var{prop}, @var{val}, @dots{})
c7e5e638a8d0 [project @ 2007-11-09 17:49:44 by jwe]
jwe
parents:
diff changeset
23 ## @deftypefnx {Function File} {} area (@var{y}, @dots{})
c7e5e638a8d0 [project @ 2007-11-09 17:49:44 by jwe]
jwe
parents:
diff changeset
24 ## @deftypefnx {Function File} {} area (@var{h}, @dots{})
c7e5e638a8d0 [project @ 2007-11-09 17:49:44 by jwe]
jwe
parents:
diff changeset
25 ## @deftypefnx {Function File} {@var{h} =} area (@dots{})
11885
3342d1a7c4c9 spelling corrections
Brian Gough<bjg@network-theory.co.uk>
parents: 7215
diff changeset
26 ## Area plot of cumulative sum of the columns of @var{y}. This shows the
7146
c7e5e638a8d0 [project @ 2007-11-09 17:49:44 by jwe]
jwe
parents:
diff changeset
27 ## contributions of a value to a sum, and is functionally similar to
c7e5e638a8d0 [project @ 2007-11-09 17:49:44 by jwe]
jwe
parents:
diff changeset
28 ## @code{plot (@var{x}, cumsum (@var{y}, 2))}, except that the area under
c7e5e638a8d0 [project @ 2007-11-09 17:49:44 by jwe]
jwe
parents:
diff changeset
29 ## the curve is shaded.
c7e5e638a8d0 [project @ 2007-11-09 17:49:44 by jwe]
jwe
parents:
diff changeset
30 ##
11885
3342d1a7c4c9 spelling corrections
Brian Gough<bjg@network-theory.co.uk>
parents: 7215
diff changeset
31 ## If the @var{x} argument is omitted it is assumed to be given by
7146
c7e5e638a8d0 [project @ 2007-11-09 17:49:44 by jwe]
jwe
parents:
diff changeset
32 ## @code{1 : rows (@var{y})}. A value @var{lvl} can be defined that determines
c7e5e638a8d0 [project @ 2007-11-09 17:49:44 by jwe]
jwe
parents:
diff changeset
33 ## where the base level of the shading under the curve should be defined.
c7e5e638a8d0 [project @ 2007-11-09 17:49:44 by jwe]
jwe
parents:
diff changeset
34 ##
c7e5e638a8d0 [project @ 2007-11-09 17:49:44 by jwe]
jwe
parents:
diff changeset
35 ## Additional arguments to the @code{area} function are passed to the
c7e5e638a8d0 [project @ 2007-11-09 17:49:44 by jwe]
jwe
parents:
diff changeset
36 ## @code{patch}. The optional return value @var{h} provides a handle to
c7e5e638a8d0 [project @ 2007-11-09 17:49:44 by jwe]
jwe
parents:
diff changeset
37 ## the list of patch objects.
c7e5e638a8d0 [project @ 2007-11-09 17:49:44 by jwe]
jwe
parents:
diff changeset
38 ## @seealso{plot, patch}
c7e5e638a8d0 [project @ 2007-11-09 17:49:44 by jwe]
jwe
parents:
diff changeset
39 ## @end deftypefn
c7e5e638a8d0 [project @ 2007-11-09 17:49:44 by jwe]
jwe
parents:
diff changeset
40
7147
fdb3840cec66 [project @ 2007-11-09 17:56:34 by jwe]
jwe
parents: 7146
diff changeset
41 function h = area (varargin)
7146
c7e5e638a8d0 [project @ 2007-11-09 17:49:44 by jwe]
jwe
parents:
diff changeset
42
7215
dd88d61d443f [project @ 2007-11-29 16:44:45 by jwe]
jwe
parents: 7147
diff changeset
43 [ax, varargin, nargin] = __plt_get_axis_arg__ ("area", varargin{:});
dd88d61d443f [project @ 2007-11-29 16:44:45 by jwe]
jwe
parents: 7147
diff changeset
44
7146
c7e5e638a8d0 [project @ 2007-11-09 17:49:44 by jwe]
jwe
parents:
diff changeset
45 if (nargin > 0)
c7e5e638a8d0 [project @ 2007-11-09 17:49:44 by jwe]
jwe
parents:
diff changeset
46 idx = 1;
c7e5e638a8d0 [project @ 2007-11-09 17:49:44 by jwe]
jwe
parents:
diff changeset
47 x = y = [];
c7e5e638a8d0 [project @ 2007-11-09 17:49:44 by jwe]
jwe
parents:
diff changeset
48 bv = 0;
c7e5e638a8d0 [project @ 2007-11-09 17:49:44 by jwe]
jwe
parents:
diff changeset
49 args = {};
7147
fdb3840cec66 [project @ 2007-11-09 17:56:34 by jwe]
jwe
parents: 7146
diff changeset
50 ## Check for (X) or (X,Y) arguments and possible base value.
7146
c7e5e638a8d0 [project @ 2007-11-09 17:49:44 by jwe]
jwe
parents:
diff changeset
51 if (nargin >= idx && ismatrix (varargin{idx}))
c7e5e638a8d0 [project @ 2007-11-09 17:49:44 by jwe]
jwe
parents:
diff changeset
52 y = varargin{idx};
c7e5e638a8d0 [project @ 2007-11-09 17:49:44 by jwe]
jwe
parents:
diff changeset
53 idx++;
c7e5e638a8d0 [project @ 2007-11-09 17:49:44 by jwe]
jwe
parents:
diff changeset
54 if (nargin >= idx)
c7e5e638a8d0 [project @ 2007-11-09 17:49:44 by jwe]
jwe
parents:
diff changeset
55 if (isscalar (varargin{idx}))
c7e5e638a8d0 [project @ 2007-11-09 17:49:44 by jwe]
jwe
parents:
diff changeset
56 bv = varargin{idx};
c7e5e638a8d0 [project @ 2007-11-09 17:49:44 by jwe]
jwe
parents:
diff changeset
57 idx++;
c7e5e638a8d0 [project @ 2007-11-09 17:49:44 by jwe]
jwe
parents:
diff changeset
58 elseif (ismatrix (varargin{idx}))
c7e5e638a8d0 [project @ 2007-11-09 17:49:44 by jwe]
jwe
parents:
diff changeset
59 x = y;
c7e5e638a8d0 [project @ 2007-11-09 17:49:44 by jwe]
jwe
parents:
diff changeset
60 y = varargin{idx};
c7e5e638a8d0 [project @ 2007-11-09 17:49:44 by jwe]
jwe
parents:
diff changeset
61 idx++;
c7e5e638a8d0 [project @ 2007-11-09 17:49:44 by jwe]
jwe
parents:
diff changeset
62 if (nargin >= idx && isscalar (varargin{idx}))
c7e5e638a8d0 [project @ 2007-11-09 17:49:44 by jwe]
jwe
parents:
diff changeset
63 bv = varargin{idx};
c7e5e638a8d0 [project @ 2007-11-09 17:49:44 by jwe]
jwe
parents:
diff changeset
64 idx++;
c7e5e638a8d0 [project @ 2007-11-09 17:49:44 by jwe]
jwe
parents:
diff changeset
65 endif
c7e5e638a8d0 [project @ 2007-11-09 17:49:44 by jwe]
jwe
parents:
diff changeset
66 endif
c7e5e638a8d0 [project @ 2007-11-09 17:49:44 by jwe]
jwe
parents:
diff changeset
67 endif
c7e5e638a8d0 [project @ 2007-11-09 17:49:44 by jwe]
jwe
parents:
diff changeset
68 else
c7e5e638a8d0 [project @ 2007-11-09 17:49:44 by jwe]
jwe
parents:
diff changeset
69 print_usage ();
c7e5e638a8d0 [project @ 2007-11-09 17:49:44 by jwe]
jwe
parents:
diff changeset
70 endif
7147
fdb3840cec66 [project @ 2007-11-09 17:56:34 by jwe]
jwe
parents: 7146
diff changeset
71 ## Check for additional args.
7146
c7e5e638a8d0 [project @ 2007-11-09 17:49:44 by jwe]
jwe
parents:
diff changeset
72 if (nargin >= idx)
c7e5e638a8d0 [project @ 2007-11-09 17:49:44 by jwe]
jwe
parents:
diff changeset
73 args = {varargin{idx:end}};
c7e5e638a8d0 [project @ 2007-11-09 17:49:44 by jwe]
jwe
parents:
diff changeset
74 endif
c7e5e638a8d0 [project @ 2007-11-09 17:49:44 by jwe]
jwe
parents:
diff changeset
75 newplot ();
c7e5e638a8d0 [project @ 2007-11-09 17:49:44 by jwe]
jwe
parents:
diff changeset
76 if (isvector (y))
c7e5e638a8d0 [project @ 2007-11-09 17:49:44 by jwe]
jwe
parents:
diff changeset
77 y = y(:);
c7e5e638a8d0 [project @ 2007-11-09 17:49:44 by jwe]
jwe
parents:
diff changeset
78 endif
c7e5e638a8d0 [project @ 2007-11-09 17:49:44 by jwe]
jwe
parents:
diff changeset
79 if (isempty (x))
c7e5e638a8d0 [project @ 2007-11-09 17:49:44 by jwe]
jwe
parents:
diff changeset
80 x = repmat ([1:size(y, 1)]', 1, size (y, 2));
c7e5e638a8d0 [project @ 2007-11-09 17:49:44 by jwe]
jwe
parents:
diff changeset
81 elseif (isvector (x))
c7e5e638a8d0 [project @ 2007-11-09 17:49:44 by jwe]
jwe
parents:
diff changeset
82 x = repmat (x(:), 1, size (y, 2));
c7e5e638a8d0 [project @ 2007-11-09 17:49:44 by jwe]
jwe
parents:
diff changeset
83 endif
c7e5e638a8d0 [project @ 2007-11-09 17:49:44 by jwe]
jwe
parents:
diff changeset
84
7215
dd88d61d443f [project @ 2007-11-29 16:44:45 by jwe]
jwe
parents: 7147
diff changeset
85 oldax = gca ();
dd88d61d443f [project @ 2007-11-29 16:44:45 by jwe]
jwe
parents: 7147
diff changeset
86 unwind_protect
dd88d61d443f [project @ 2007-11-29 16:44:45 by jwe]
jwe
parents: 7147
diff changeset
87 axes (ax);
7146
c7e5e638a8d0 [project @ 2007-11-09 17:49:44 by jwe]
jwe
parents:
diff changeset
88 tmp = __area__ (ax, x, y, bv, args{:});
7215
dd88d61d443f [project @ 2007-11-29 16:44:45 by jwe]
jwe
parents: 7147
diff changeset
89 unwind_protect_cleanup
dd88d61d443f [project @ 2007-11-29 16:44:45 by jwe]
jwe
parents: 7147
diff changeset
90 axes (oldax);
dd88d61d443f [project @ 2007-11-29 16:44:45 by jwe]
jwe
parents: 7147
diff changeset
91 end_unwind_protect
7146
c7e5e638a8d0 [project @ 2007-11-09 17:49:44 by jwe]
jwe
parents:
diff changeset
92
c7e5e638a8d0 [project @ 2007-11-09 17:49:44 by jwe]
jwe
parents:
diff changeset
93 if (nargout > 0)
c7e5e638a8d0 [project @ 2007-11-09 17:49:44 by jwe]
jwe
parents:
diff changeset
94 h = tmp;
c7e5e638a8d0 [project @ 2007-11-09 17:49:44 by jwe]
jwe
parents:
diff changeset
95 endif
c7e5e638a8d0 [project @ 2007-11-09 17:49:44 by jwe]
jwe
parents:
diff changeset
96 else
c7e5e638a8d0 [project @ 2007-11-09 17:49:44 by jwe]
jwe
parents:
diff changeset
97 print_usage ();
c7e5e638a8d0 [project @ 2007-11-09 17:49:44 by jwe]
jwe
parents:
diff changeset
98 endif
c7e5e638a8d0 [project @ 2007-11-09 17:49:44 by jwe]
jwe
parents:
diff changeset
99
c7e5e638a8d0 [project @ 2007-11-09 17:49:44 by jwe]
jwe
parents:
diff changeset
100 endfunction