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