annotate scripts/plot/__contour__.m @ 7170:9f38c6293317

[project @ 2007-11-13 17:34:33 by jwe]
author jwe
date Tue, 13 Nov 2007 17:34:33 +0000
parents
children 5ff4da7bd2e7
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
7170
9f38c6293317 [project @ 2007-11-13 17:34:33 by jwe]
jwe
parents:
diff changeset
1 ## Copyright (C) 2007 David Bateman
9f38c6293317 [project @ 2007-11-13 17:34:33 by jwe]
jwe
parents:
diff changeset
2 ##
9f38c6293317 [project @ 2007-11-13 17:34:33 by jwe]
jwe
parents:
diff changeset
3 ## This file is part of Octave.
9f38c6293317 [project @ 2007-11-13 17:34:33 by jwe]
jwe
parents:
diff changeset
4 ##
9f38c6293317 [project @ 2007-11-13 17:34:33 by jwe]
jwe
parents:
diff changeset
5 ## Octave is free software; you can redistribute it and/or modify it
9f38c6293317 [project @ 2007-11-13 17:34:33 by jwe]
jwe
parents:
diff changeset
6 ## under the terms of the GNU General Public License as published by
9f38c6293317 [project @ 2007-11-13 17:34:33 by jwe]
jwe
parents:
diff changeset
7 ## the Free Software Foundation; either version 3 of the License, or (at
9f38c6293317 [project @ 2007-11-13 17:34:33 by jwe]
jwe
parents:
diff changeset
8 ## your option) any later version.
9f38c6293317 [project @ 2007-11-13 17:34:33 by jwe]
jwe
parents:
diff changeset
9 ##
9f38c6293317 [project @ 2007-11-13 17:34:33 by jwe]
jwe
parents:
diff changeset
10 ## Octave is distributed in the hope that it will be useful, but
9f38c6293317 [project @ 2007-11-13 17:34:33 by jwe]
jwe
parents:
diff changeset
11 ## WITHOUT ANY WARRANTY; without even the implied warranty of
9f38c6293317 [project @ 2007-11-13 17:34:33 by jwe]
jwe
parents:
diff changeset
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
9f38c6293317 [project @ 2007-11-13 17:34:33 by jwe]
jwe
parents:
diff changeset
13 ## General Public License for more details.
9f38c6293317 [project @ 2007-11-13 17:34:33 by jwe]
jwe
parents:
diff changeset
14 ##
9f38c6293317 [project @ 2007-11-13 17:34:33 by jwe]
jwe
parents:
diff changeset
15 ## You should have received a copy of the GNU General Public License
9f38c6293317 [project @ 2007-11-13 17:34:33 by jwe]
jwe
parents:
diff changeset
16 ## along with Octave; see the file COPYING. If not, see
9f38c6293317 [project @ 2007-11-13 17:34:33 by jwe]
jwe
parents:
diff changeset
17 ## <http://www.gnu.org/licenses/>.
9f38c6293317 [project @ 2007-11-13 17:34:33 by jwe]
jwe
parents:
diff changeset
18
9f38c6293317 [project @ 2007-11-13 17:34:33 by jwe]
jwe
parents:
diff changeset
19 ## Undocumented internal function.
9f38c6293317 [project @ 2007-11-13 17:34:33 by jwe]
jwe
parents:
diff changeset
20
9f38c6293317 [project @ 2007-11-13 17:34:33 by jwe]
jwe
parents:
diff changeset
21 function [c, h] = __contour__ (varargin)
9f38c6293317 [project @ 2007-11-13 17:34:33 by jwe]
jwe
parents:
diff changeset
22
9f38c6293317 [project @ 2007-11-13 17:34:33 by jwe]
jwe
parents:
diff changeset
23 ax = varargin {1};
9f38c6293317 [project @ 2007-11-13 17:34:33 by jwe]
jwe
parents:
diff changeset
24 z = varargin {2};
9f38c6293317 [project @ 2007-11-13 17:34:33 by jwe]
jwe
parents:
diff changeset
25
9f38c6293317 [project @ 2007-11-13 17:34:33 by jwe]
jwe
parents:
diff changeset
26 clim = get (ax, "clim");
9f38c6293317 [project @ 2007-11-13 17:34:33 by jwe]
jwe
parents:
diff changeset
27
9f38c6293317 [project @ 2007-11-13 17:34:33 by jwe]
jwe
parents:
diff changeset
28 [c, lev] = contourc (varargin{3:end});
9f38c6293317 [project @ 2007-11-13 17:34:33 by jwe]
jwe
parents:
diff changeset
29
9f38c6293317 [project @ 2007-11-13 17:34:33 by jwe]
jwe
parents:
diff changeset
30 ## Decode contourc output format.
9f38c6293317 [project @ 2007-11-13 17:34:33 by jwe]
jwe
parents:
diff changeset
31 i1 = 1;
9f38c6293317 [project @ 2007-11-13 17:34:33 by jwe]
jwe
parents:
diff changeset
32 h = [];
9f38c6293317 [project @ 2007-11-13 17:34:33 by jwe]
jwe
parents:
diff changeset
33 maxlev = max (lev);
9f38c6293317 [project @ 2007-11-13 17:34:33 by jwe]
jwe
parents:
diff changeset
34 minlev = min (lev);
9f38c6293317 [project @ 2007-11-13 17:34:33 by jwe]
jwe
parents:
diff changeset
35 while (i1 < length (c))
9f38c6293317 [project @ 2007-11-13 17:34:33 by jwe]
jwe
parents:
diff changeset
36 clev = c(1,i1);
9f38c6293317 [project @ 2007-11-13 17:34:33 by jwe]
jwe
parents:
diff changeset
37 clen = c(2,i1);
9f38c6293317 [project @ 2007-11-13 17:34:33 by jwe]
jwe
parents:
diff changeset
38
9f38c6293317 [project @ 2007-11-13 17:34:33 by jwe]
jwe
parents:
diff changeset
39 ii = i1+1:i1+clen;
9f38c6293317 [project @ 2007-11-13 17:34:33 by jwe]
jwe
parents:
diff changeset
40 lev = (clev - minlev) * (clim(2) - clim(1)) / (maxlev - minlev) + clim(1);
9f38c6293317 [project @ 2007-11-13 17:34:33 by jwe]
jwe
parents:
diff changeset
41
9f38c6293317 [project @ 2007-11-13 17:34:33 by jwe]
jwe
parents:
diff changeset
42 if (isnan (z))
9f38c6293317 [project @ 2007-11-13 17:34:33 by jwe]
jwe
parents:
diff changeset
43 h = [h; patch(ax, c(1,ii), c(2,ii), "facecolor", "none",
9f38c6293317 [project @ 2007-11-13 17:34:33 by jwe]
jwe
parents:
diff changeset
44 "edgecolor", "flat", "cdata", lev)];
9f38c6293317 [project @ 2007-11-13 17:34:33 by jwe]
jwe
parents:
diff changeset
45 else
9f38c6293317 [project @ 2007-11-13 17:34:33 by jwe]
jwe
parents:
diff changeset
46 h = [h; patch(ax, c(1,ii), c(2,ii), z*ones(size(ii)), "facecolor",
9f38c6293317 [project @ 2007-11-13 17:34:33 by jwe]
jwe
parents:
diff changeset
47 "none", "edgecolor", "flat", "cdata", lev)];
9f38c6293317 [project @ 2007-11-13 17:34:33 by jwe]
jwe
parents:
diff changeset
48 endif
9f38c6293317 [project @ 2007-11-13 17:34:33 by jwe]
jwe
parents:
diff changeset
49 i1 += clen+1;
9f38c6293317 [project @ 2007-11-13 17:34:33 by jwe]
jwe
parents:
diff changeset
50 endwhile
9f38c6293317 [project @ 2007-11-13 17:34:33 by jwe]
jwe
parents:
diff changeset
51
9f38c6293317 [project @ 2007-11-13 17:34:33 by jwe]
jwe
parents:
diff changeset
52 endfunction