annotate scripts/plot/__area__.m @ 7269:3fade00a6ac7

[project @ 2007-12-07 19:26:20 by jwe]
author jwe
date Fri, 07 Dec 2007 19:26:21 +0000
parents fdb3840cec66
children 9a6f4713f765
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)
7147
fdb3840cec66 [project @ 2007-11-09 17:56:34 by jwe]
jwe
parents: 7146
diff changeset
22
7146
c7e5e638a8d0 [project @ 2007-11-09 17:49:44 by jwe]
jwe
parents:
diff changeset
23 colors = [1, 0, 0; 0, 1, 0; 0, 0, 1; 1, 1, 0; 1, 0, 1; 0, 1, 1];
7147
fdb3840cec66 [project @ 2007-11-09 17:56:34 by jwe]
jwe
parents: 7146
diff changeset
24
fdb3840cec66 [project @ 2007-11-09 17:56:34 by jwe]
jwe
parents: 7146
diff changeset
25 x = [x(1,:); x; x(end,:)];
fdb3840cec66 [project @ 2007-11-09 17:56:34 by jwe]
jwe
parents: 7146
diff changeset
26
fdb3840cec66 [project @ 2007-11-09 17:56:34 by jwe]
jwe
parents: 7146
diff changeset
27 y = cumsum ([[bv, ones(1, size (y, 2) - 1)]; y;
7146
c7e5e638a8d0 [project @ 2007-11-09 17:49:44 by jwe]
jwe
parents:
diff changeset
28 [bv, ones(1, size (y, 2) - 1)]], 2);
c7e5e638a8d0 [project @ 2007-11-09 17:49:44 by jwe]
jwe
parents:
diff changeset
29
7147
fdb3840cec66 [project @ 2007-11-09 17:56:34 by jwe]
jwe
parents: 7146
diff changeset
30 retval = patch (ax, x(:,1), y(:,1), colors(1,:), varargin{:});
fdb3840cec66 [project @ 2007-11-09 17:56:34 by jwe]
jwe
parents: 7146
diff changeset
31
fdb3840cec66 [project @ 2007-11-09 17:56:34 by jwe]
jwe
parents: 7146
diff changeset
32 for i = 2:size(y,2)
fdb3840cec66 [project @ 2007-11-09 17:56:34 by jwe]
jwe
parents: 7146
diff changeset
33 tmp = patch (ax, [x(:,i); flipud(x(:,i))],
fdb3840cec66 [project @ 2007-11-09 17:56:34 by jwe]
jwe
parents: 7146
diff changeset
34 [y(:,i) ; flipud(y(:, i-1))], colors(i,:), varargin{:});
fdb3840cec66 [project @ 2007-11-09 17:56:34 by jwe]
jwe
parents: 7146
diff changeset
35
fdb3840cec66 [project @ 2007-11-09 17:56:34 by jwe]
jwe
parents: 7146
diff changeset
36 retval = [retval; tmp];
7146
c7e5e638a8d0 [project @ 2007-11-09 17:49:44 by jwe]
jwe
parents:
diff changeset
37 endfor
7147
fdb3840cec66 [project @ 2007-11-09 17:56:34 by jwe]
jwe
parents: 7146
diff changeset
38
7146
c7e5e638a8d0 [project @ 2007-11-09 17:49:44 by jwe]
jwe
parents:
diff changeset
39 endfunction