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 |
7208
|
23 ax = varargin{1}; |
|
24 z = varargin{2}; |
7170
|
25 |
7175
|
26 if (ischar (z)) |
|
27 if (strcmp (z, "none")) |
|
28 z = NaN; |
|
29 elseif (strcmp (z, "base")) |
|
30 if (nargin == 1) |
7208
|
31 z = varargin{1}; |
7175
|
32 else |
7208
|
33 z = varargin{3}; |
7175
|
34 endif |
7191
|
35 z = 2 * (min (z(:)) - max (z(:))); |
|
36 elseif (! strcmp (z, "level")) |
7175
|
37 error ("unrecognized z argument"); |
|
38 endif |
|
39 endif |
|
40 |
7170
|
41 [c, lev] = contourc (varargin{3:end}); |
|
42 |
|
43 ## Decode contourc output format. |
|
44 i1 = 1; |
|
45 h = []; |
|
46 while (i1 < length (c)) |
|
47 clev = c(1,i1); |
|
48 clen = c(2,i1); |
|
49 |
7175
|
50 if (all (c(:,i1+1) == c(:,i1+clen))) |
|
51 p = c(:, i1+1:i1+clen-1); |
|
52 else |
|
53 p = [c(:, i1+1:i1+clen), NaN(2, 1)]; |
|
54 endif |
|
55 |
7170
|
56 if (isnan (z)) |
7175
|
57 h = [h; patch(ax, p(1,:), p(2,:), "facecolor", "none", |
7189
|
58 "edgecolor", "flat", "cdata", clev)]; |
7175
|
59 elseif (!ischar(z)) |
|
60 h = [h; patch(ax, p(1,:), p(2,:), z * ones (1, columns (p)), "facecolor", |
7189
|
61 "none", "edgecolor", "flat", "cdata", clev)]; |
7170
|
62 else |
7175
|
63 h = [h; patch(ax, p(1,:), p(2,:), clev * ones (1, columns (p)), |
7189
|
64 "facecolor", "none", "edgecolor", "flat", "cdata", clev)]; |
7170
|
65 endif |
|
66 i1 += clen+1; |
|
67 endwhile |
|
68 |
|
69 endfunction |