annotate scripts/plot/__area__.m @ 7146:c7e5e638a8d0

[project @ 2007-11-09 17:49:44 by jwe]
author jwe
date Fri, 09 Nov 2007 17:51:42 +0000
parents
children fdb3840cec66
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 David Bateman
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 ## Undocumented internal function.
c7e5e638a8d0 [project @ 2007-11-09 17:49:44 by jwe]
jwe
parents:
diff changeset
20
c7e5e638a8d0 [project @ 2007-11-09 17:49:44 by jwe]
jwe
parents:
diff changeset
21 function retval = __area__ (ax, x, y, bv, varargin)
c7e5e638a8d0 [project @ 2007-11-09 17:49:44 by jwe]
jwe
parents:
diff changeset
22 colors = [1, 0, 0; 0, 1, 0; 0, 0, 1; 1, 1, 0; 1, 0, 1; 0, 1, 1];
c7e5e638a8d0 [project @ 2007-11-09 17:49:44 by jwe]
jwe
parents:
diff changeset
23 x = [x(1,:) ; x ; x(end,:)];
c7e5e638a8d0 [project @ 2007-11-09 17:49:44 by jwe]
jwe
parents:
diff changeset
24 y = cumsum ([[bv, ones(1, size (y, 2) - 1)] ; y ; ...
c7e5e638a8d0 [project @ 2007-11-09 17:49:44 by jwe]
jwe
parents:
diff changeset
25 [bv, ones(1, size (y, 2) - 1)]], 2);
c7e5e638a8d0 [project @ 2007-11-09 17:49:44 by jwe]
jwe
parents:
diff changeset
26
c7e5e638a8d0 [project @ 2007-11-09 17:49:44 by jwe]
jwe
parents:
diff changeset
27 retval = patch (ax, x(:, 1), y (:, 1), colors (1,:), varargin{:});
c7e5e638a8d0 [project @ 2007-11-09 17:49:44 by jwe]
jwe
parents:
diff changeset
28 for i = 2 : size(y, 2)
c7e5e638a8d0 [project @ 2007-11-09 17:49:44 by jwe]
jwe
parents:
diff changeset
29 retval = [retval; patch(ax, [x(:,i); flipud(x(:,i))], ...
c7e5e638a8d0 [project @ 2007-11-09 17:49:44 by jwe]
jwe
parents:
diff changeset
30 [y(:, i) ; flipud(y(:, i-1))], colors(i,:),
c7e5e638a8d0 [project @ 2007-11-09 17:49:44 by jwe]
jwe
parents:
diff changeset
31 varargin{:})];
c7e5e638a8d0 [project @ 2007-11-09 17:49:44 by jwe]
jwe
parents:
diff changeset
32 endfor
c7e5e638a8d0 [project @ 2007-11-09 17:49:44 by jwe]
jwe
parents:
diff changeset
33 endfunction