Mercurial > hg > octave-nkf
annotate scripts/plot/__contour__.m @ 8289:ac7f334d9652
Add contour group objects and the clabel function
author | David Bateman <dbateman@free.fr> |
---|---|
date | Thu, 30 Oct 2008 00:13:05 +0100 |
parents | 73d6b71788c0 |
children | be9b14945774 |
rev | line source |
---|---|
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 | |
8289
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
21 function [c, hg] = __contour__ (varargin) |
7208 | 22 ax = varargin{1}; |
8289
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
23 zlevel = varargin{2}; |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
24 filled = "off"; |
7170 | 25 |
7317 | 26 linespec.linestyle = "-"; |
8289
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
27 linespec.color = "auto"; |
7317 | 28 for i = 3 : nargin |
29 arg = varargin {i}; | |
30 if ((ischar (arg) || iscell (arg))) | |
8289
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
31 [linespec, valid] = __pltopt__ ("__contour__", arg, false); |
7317 | 32 if (isempty (linespec.color)) |
8289
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
33 linespec.color = "auto"; |
7317 | 34 endif |
35 if (valid) | |
36 have_line_spec = true; | |
37 varargin(i) = []; | |
38 break; | |
39 endif | |
40 endif | |
41 endfor | |
42 | |
7462
dfcaf7ed48e3
Allow linewidth to be specified for contours
David Bateman
parents:
7317
diff
changeset
|
43 opts = {}; |
dfcaf7ed48e3
Allow linewidth to be specified for contours
David Bateman
parents:
7317
diff
changeset
|
44 i = 3; |
dfcaf7ed48e3
Allow linewidth to be specified for contours
David Bateman
parents:
7317
diff
changeset
|
45 while (i < length (varargin)) |
dfcaf7ed48e3
Allow linewidth to be specified for contours
David Bateman
parents:
7317
diff
changeset
|
46 if (ischar (varargin {i})) |
8289
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
47 if (strcmpi (varargin{i}, "fill")) |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
48 filled = varargin {i + 1}; |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
49 varargin(i:i+1) = []; |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
50 elseif (strcmpi (varargin{i}, "linecolor")) |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
51 linespec.color = varargin {i + 1}; |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
52 varargin(i:i+1) = []; |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
53 else |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
54 opts{end+1} = varargin{i}; |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
55 varargin(i) = []; |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
56 opts{end+1} = varargin{i}; |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
57 varargin(i) = []; |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
58 endif |
7462
dfcaf7ed48e3
Allow linewidth to be specified for contours
David Bateman
parents:
7317
diff
changeset
|
59 else |
dfcaf7ed48e3
Allow linewidth to be specified for contours
David Bateman
parents:
7317
diff
changeset
|
60 i++; |
dfcaf7ed48e3
Allow linewidth to be specified for contours
David Bateman
parents:
7317
diff
changeset
|
61 endif |
dfcaf7ed48e3
Allow linewidth to be specified for contours
David Bateman
parents:
7317
diff
changeset
|
62 endwhile |
dfcaf7ed48e3
Allow linewidth to be specified for contours
David Bateman
parents:
7317
diff
changeset
|
63 |
8289
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
64 if (length(varargin) < 5) |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
65 z1 = varargin{3}; |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
66 x1 = 1 : rows(z1); |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
67 y1 = 1 : columns(z1); |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
68 else |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
69 x1 = varargin{3}; |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
70 y1 = varargin{4}; |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
71 z1 = varargin{5}; |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
72 endif |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
73 if (length (varargin) == 4 || length (varargin) == 6) |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
74 vn = varargin {end}; |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
75 vnauto = false; |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
76 else |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
77 vnauto = true; |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
78 vn = 10; |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
79 endif |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
80 |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
81 if (strcmpi (filled, "on")) |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
82 if (isvector (x1) || isvector (y1)) |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
83 [x1, y1] = meshgrid (x1, y1); |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
84 endif |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
85 [nr, nc] = size (z1); |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
86 x0 = prepad(x1, nc+1, 2 * x1(1, 1) - x1(1, 2), 2); |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
87 x0 = postpad(x0, nc+2, 2 * x1(1, nc) - x1(1, nc - 1), 2); |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
88 x0 = [x0(1, :); x0; x0(1, :)]; |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
89 y0 = prepad(y1, nr+1, 2 * y1(1, 1) - y1(2, 1), 1); |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
90 y0 = postpad(y0, nr+2, 2 * y1(nr, 1) - y1(nr - 1, 1)); |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
91 y0 = [y0(:, 1), y0, y0(:, 1)]; |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
92 z0 = -Inf(nr+2, nc+2); |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
93 z0(2:nr+1, 2:nc+1) = z1; |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
94 [c, lev] = contourc (x0, y0, z0, vn); |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
95 else |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
96 [c, lev] = contourc (x1, y1, z1, vn); |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
97 endif |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
98 |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
99 hg = hggroup (); |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
100 opts = __add_datasource__ ("__countour__", hg, {"x", "y", "z"}, opts{:}); |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
101 |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
102 addproperty ("xdata", hg, "data", x1); |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
103 addproperty ("ydata", hg, "data", y1); |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
104 addproperty ("zdata", hg, "data", z1); |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
105 addproperty ("contourmatrix", hg, "data", c); |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
106 |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
107 addlistener (hg, "xdata", @update_data); |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
108 addlistener (hg, "ydata", @update_data); |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
109 addlistener (hg, "zdata", @update_data); |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
110 addlistener (hg, "contourmatrix", @update_data); |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
111 |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
112 addproperty ("fill", hg, "radio", "on|{off}", filled); |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
113 |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
114 ## The properties zlevel and zlevelmode don't exist in matlab, but |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
115 ## allow the use of contourgroups with the contour3, meshc and surfc |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
116 ## functions. |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
117 if (isnumeric (zlevel)) |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
118 addproperty ("zlevelmode", hg, "radio", "{none}|auto|manual", "manual") |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
119 addproperty ("zlevel", hg, "data", zlevel); |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
120 else |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
121 addproperty ("zlevelmode", hg, "radio", "{none}|auto|manual", zlevel) |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
122 if (ischar (zlevel) && strcmpi (zlevel, "manual")) |
7462
dfcaf7ed48e3
Allow linewidth to be specified for contours
David Bateman
parents:
7317
diff
changeset
|
123 z = varargin{3}; |
7191 | 124 z = 2 * (min (z(:)) - max (z(:))); |
8289
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
125 addproperty ("zlevel", hg, "data", z); |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
126 else |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
127 addproperty ("zlevel", hg, "data", 0.); |
7175 | 128 endif |
129 endif | |
130 | |
8289
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
131 if (isscalar (vn)) |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
132 lvlstep = (max(z1(:)) - min(z1(:))) / vn; |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
133 else |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
134 lvlstep = (max(z1(:)) - min(z1(:))) / 10; |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
135 endif |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
136 |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
137 addproperty ("levellist", hg, "data", lev); |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
138 addproperty ("levelstep", hg, "double", lvlstep); |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
139 if (vnauto) |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
140 addproperty ("levellistmode", hg, "radio", "{auto}|manual", "auto"); |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
141 addproperty ("levelstepmode", hg, "radio", "{auto}|manual", "auto"); |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
142 elseif (isscalar (vn)) |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
143 addproperty ("levellistmode", hg, "radio", "{auto}|manual", "auto"); |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
144 addproperty ("levelstepmode", hg, "radio", "{auto}|manual", "manual"); |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
145 else |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
146 addproperty ("levellistmode", hg, "radio", "{auto}|manual", "manual"); |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
147 addproperty ("levelstepmode", hg, "radio", "{auto}|manual", "auto"); |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
148 endif |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
149 |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
150 addproperty ("labelspacing", hg, "double", 144); |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
151 addproperty ("textlist", hg, "data", lev); |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
152 addproperty ("textlistmode", hg, "radio", "{auto}|manual", "auto"); |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
153 addproperty ("textstep", hg, "double", lvlstep); |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
154 addproperty ("textstepmode", hg, "radio", "{auto}|manual", "auto"); |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
155 addproperty ("showtext", hg, "radio", "on|{off}", "off"); |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
156 |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
157 addproperty ("linecolor", hg, "color", linespec.color, "{auto}|none"); |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
158 addproperty ("linestyle", hg, "linelinestyle", linespec.linestyle); |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
159 addproperty ("linewidth", hg, "linelinewidth", 0.5); |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
160 |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
161 addlistener (hg, "fill", @update_data); |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
162 |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
163 addlistener (hg, "zlevelmode", @update_zlevel); |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
164 addlistener (hg, "zlevel", @update_zlevel); |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
165 |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
166 addlistener (hg, "levellist", @update_data); |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
167 addlistener (hg, "levelstep", @update_data); |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
168 addlistener (hg, "levellistmode", @update_data); |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
169 addlistener (hg, "levelstepmode", @update_data); |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
170 |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
171 addlistener (hg, "labelspacing", @update_text); |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
172 addlistener (hg, "textlist", @update_text); |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
173 addlistener (hg, "textlistmode", @update_text); |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
174 addlistener (hg, "textstep", @update_text); |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
175 addlistener (hg, "textstepmode", @update_text); |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
176 addlistener (hg, "showtext", @update_text); |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
177 |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
178 addlistener (hg, "linecolor", @update_line); |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
179 addlistener (hg, "linestyle", @update_line); |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
180 addlistener (hg, "linewidth", @update_line); |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
181 |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
182 add_patch_children (hg); |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
183 |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
184 if (!isempty (opts)) |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
185 set (hg, opts{:}); |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
186 endif |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
187 endfunction |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
188 |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
189 function add_patch_children (hg) |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
190 c = get (hg, "contourmatrix"); |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
191 lev = get (hg, "levellist"); |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
192 fill = get (hg, "fill"); |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
193 z = get (hg, "zlevel"); |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
194 zmode = get (hg, "zlevelmode"); |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
195 lc = get (hg, "linecolor"); |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
196 lw = get (hg, "linewidth"); |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
197 ls = get (hg, "linestyle"); |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
198 filled = get (hg, "fill"); |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
199 |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
200 if (strcmpi (lc, "auto")) |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
201 lc = "flat"; |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
202 endif |
7170 | 203 |
8289
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
204 if (strcmpi (filled, "on")) |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
205 if (diff (lev) < 10*eps) |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
206 lvl_eps = 1e-6; |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
207 else |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
208 lvl_eps = min (diff (lev)) / 1000.0; |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
209 endif |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
210 |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
211 ## Decode contourc output format. |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
212 i1 = 1; |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
213 ncont = 0; |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
214 while (i1 < columns (c)) |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
215 ncont++; |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
216 cont_lev(ncont) = c(1, i1); |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
217 cont_len(ncont) = c(2, i1); |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
218 cont_idx(ncont) = i1+1; |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
219 |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
220 ii = i1+1:i1+cont_len(ncont); |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
221 cur_cont = c(:, ii); |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
222 startidx = ii(1); |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
223 stopidx = ii(end); |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
224 cont_area(ncont) = polyarea (c(1, ii), c(2, ii)); |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
225 i1 += c(2, i1) + 1; |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
226 endwhile |
7170 | 227 |
8289
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
228 ## Handle for each level the case where we have (a) hole(s) in a patch. |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
229 ## Those are to be filled with the color of level below or with the |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
230 ## background colour. |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
231 for k = 1:numel (lev) |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
232 lvl_idx = find (abs (cont_lev - lev(k)) < lvl_eps); |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
233 len = numel (lvl_idx); |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
234 if (len > 1) |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
235 ## mark = logical(zeros(size(lvl_idx))); |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
236 mark = false (size (lvl_idx)); |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
237 a = 1; |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
238 while (a < len) |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
239 ## take 1st patch |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
240 b = a + 1; |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
241 pa_idx = lvl_idx(a); |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
242 ## get pointer to contour start, and contour length |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
243 curr_ct_idx = cont_idx(pa_idx); |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
244 curr_ct_len = cont_len(pa_idx); |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
245 ## get contour |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
246 curr_ct = c(:, curr_ct_idx:curr_ct_idx+curr_ct_len-1); |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
247 b_vec = (a+1):len; |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
248 next_ct_pt_vec = c(:, cont_idx(lvl_idx(b_vec))); |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
249 in = inpolygon (next_ct_pt_vec(1,:), next_ct_pt_vec(2,:), |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
250 curr_ct(1, :), curr_ct(2, :)); |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
251 mark(b_vec(in)) = !mark(b_vec(in)); |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
252 a++; |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
253 endwhile |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
254 if (numel (mark) > 0) |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
255 ## All marked contours describe a hole in a larger contour of |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
256 ## the same level and must be filled with colour of level below. |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
257 ma_idx = lvl_idx(mark); |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
258 if (k > 1) |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
259 ## Find color of level below. |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
260 tmp = find(abs(cont_lev - lev(k - 1)) < lvl_eps); |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
261 lvl_bel_idx = tmp(1); |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
262 ## Set color of patches found. |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
263 cont_lev(ma_idx) = cont_lev(lvl_bel_idx); |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
264 else |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
265 ## Set lowest level contour to NaN. |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
266 cont_lev(ma_idx) = NaN; |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
267 endif |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
268 endif |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
269 endif |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
270 endfor |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
271 |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
272 ## The algorithm can create patches with the size of the plotting |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
273 ## area, we would like to draw only the patch with the highest level. |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
274 del_idx = []; |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
275 max_idx = find (cont_area == max (cont_area)); |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
276 if (numel (max_idx) > 1) |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
277 ## delete double entries |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
278 del_idx = max_idx(1:end-1); |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
279 cont_area(del_idx) = cont_lev(del_idx) = []; |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
280 cont_len(del_idx) = cont_idx(del_idx) = []; |
7175 | 281 endif |
282 | |
8289
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
283 ## Now we have everything together and can start plotting the patches |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
284 ## beginning with largest area. |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
285 [tmp, svec] = sort (cont_area); |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
286 len = ncont - numel (del_idx); |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
287 h = []; |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
288 for n = 1:len |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
289 idx = svec(n); |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
290 ctmp = c(:, cont_idx(idx):cont_idx(idx) + cont_len(idx) - 1); |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
291 if (all (ctmp(:,1) == ctmp(:,end))) |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
292 ctmp(:, end) = []; |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
293 else |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
294 ## Special case unclosed contours |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
295 endif |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
296 h = [h; patch(ctmp(1, :), ctmp(2, :), cont_lev(idx), "edgecolor", lc, |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
297 "linestyle", ls, "linewidth", lw, "parent", hg)]; |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
298 endfor |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
299 |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
300 if (min (lev) == max (lev)) |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
301 set (gca (), "clim", [min(lev)-1, max(lev)+1]); |
7170 | 302 else |
8289
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
303 set (gca(), "clim", [min(lev), max(lev)]); |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
304 endif |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
305 |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
306 set (gca (), "layer", "top"); |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
307 else |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
308 ## Decode contourc output format. |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
309 i1 = 1; |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
310 h = []; |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
311 while (i1 < length (c)) |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
312 clev = c(1,i1); |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
313 clen = c(2,i1); |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
314 |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
315 if (all (c(:,i1+1) == c(:,i1+clen))) |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
316 p = c(:, i1+1:i1+clen-1); |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
317 else |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
318 p = [c(:, i1+1:i1+clen), NaN(2, 1)]; |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
319 endif |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
320 |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
321 switch (zmode) |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
322 case "none" |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
323 h = [h; patch(p(1,:), p(2,:), "facecolor", "none", |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
324 "edgecolor", lc, "linestyle", ls, "linewidth", lw, |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
325 "cdata", clev, "parent", hg)]; |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
326 case "auto" |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
327 h = [h; patch(p(1,:), p(2,:), clev * ones (1, columns (p)), |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
328 "facecolor", "none", "edgecolor", lc, |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
329 "linestyle", ls, "linewidth", lw, "cdata", clev, |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
330 "parent", hg)]; |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
331 otherwise |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
332 h = [h; patch(p(1,:), p(2,:), z * ones (1, columns (p)), |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
333 "facecolor", "none", "edgecolor", lc, |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
334 "linestyle", ls, "linewidth", lw, "cdata", clev, |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
335 "parent", hg)]; |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
336 endswitch |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
337 i1 += clen+1; |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
338 endwhile |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
339 endif |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
340 |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
341 endfunction |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
342 |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
343 function update_zlevel (h, d) |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
344 z = get (h, "zlevel"); |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
345 zmode = get (h, "zlevelmode"); |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
346 kids = get (h, "children"); |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
347 |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
348 switch (zmode) |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
349 case "none" |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
350 set (kids, "zdata", []); |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
351 case "auto" |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
352 for i = 1 : length (kids) |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
353 set (kids(i), "zdata", get (kids (i), "cdata") .* |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
354 ones (size (get (kids (i), "xdata")))); |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
355 endfor |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
356 otherwise |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
357 for i = 1 : length (kids) |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
358 set (kids(i), "zdata", z .* ones (size (get (kids (i), "xdata")))); |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
359 endfor |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
360 endswitch |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
361 endfunction |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
362 |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
363 function update_line (h, d) |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
364 lc = get (h, "linecolor"); |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
365 if (strcmpi (lc, "auto")) |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
366 lc = "flat"; |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
367 endif |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
368 set (findobj (h, "type", "patch"), "edgecolor", lc, |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
369 "linewidth", get (h, "linewidth"), "linestyle", get (h, "linestyle")); |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
370 endfunction |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
371 |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
372 function update_data (h, d) |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
373 persistent recursive = false; |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
374 |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
375 if (!recursive) |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
376 recursive = true; |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
377 |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
378 delete (get (h, "children")); |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
379 |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
380 if (strcmpi (get (h, "levellistmode"), "manual")) |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
381 lvl = get (h, "levellist"); |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
382 elseif (strcmpi (get (h, "levelstepmode"), "manual")) |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
383 z = get (h, "zdata"); |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
384 lvl = ceil ((max(z(:)) - min (z(:)) ./ get (h, "levelstep"))); |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
385 else |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
386 lvl = 10; |
7170 | 387 endif |
8289
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
388 |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
389 if (strcmpi (get (h, "fill"), "on")) |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
390 X = get (h, "xdata"); |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
391 Y = get (h, "ydata"); |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
392 Z = get (h, "zdata"); |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
393 if (isvector (X) || isvector (Y)) |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
394 [X, Y] = meshgrid (X, Y); |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
395 endif |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
396 [nr, nc] = size (Z); |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
397 X0 = prepad(X, nc+1, 2 * X(1, 1) - X(1, 2), 2); |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
398 X0 = postpad(X0, nc+2, 2 * X(1, nc) - X(1, nc - 1), 2); |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
399 X0 = [X0(1, :); X0; X0(1, :)]; |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
400 Y0 = prepad(Y, nr+1, 2 * Y(1, 1) - Y(2, 1), 1); |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
401 Y0 = postpad(Y0, nr+2, 2 * Y(nr, 1) - Y(nr - 1, 1)); |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
402 Y0 = [Y0(:, 1), Y0, Y0(:, 1)]; |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
403 Z0 = -Inf(nr+2, nc+2); |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
404 Z0(2:nr+1, 2:nc+1) = Z; |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
405 [c, lev] = contourc (X0, Y0, Z0, lvl); |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
406 else |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
407 [c, lev] = contourc (get (h, "xdata"), get (h, "ydata"), |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
408 get (h, "zdata"), lvl); |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
409 endif |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
410 set (h, "contourmatrix", c); |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
411 |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
412 if (strcmpi (get (h, "levellistmode"), "manual")) |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
413 ## Do nothing |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
414 elseif (strcmpi (get (h, "levelstepmode"), "manual")) |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
415 set (h, "levellist", lev); |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
416 else |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
417 set (h, "levellist", lev); |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
418 z = get (h, "zdata"); |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
419 lvlstep = (max(z(:)) - min(z(:))) / 10; |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
420 set (h, "levelstep", lvlstep); |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
421 endif |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
422 |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
423 add_patch_children (h); |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
424 update_text (h, d); |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
425 endif |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
426 |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
427 recursive = false; |
7170 | 428 endfunction |
8289
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
429 |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
430 function update_text (h, d) |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
431 persistent recursive = false; |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
432 |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
433 if (!recursive) |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
434 recursive = true; |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
435 |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
436 delete (findobj (h, "type", "text")); |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
437 |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
438 if (strcmpi (get (h, "textlistmode"), "manual")) |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
439 lvl = get (h, "textlist"); |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
440 elseif (strcmpi (get (h, "textstepmode"), "manual")) |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
441 lev = get (h, "levellist"); |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
442 |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
443 if (diff (lev) < 10*eps) |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
444 lvl_eps = 1e-6; |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
445 else |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
446 lvl_eps = min (abs (diff (lev))) / 1000.0; |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
447 endif |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
448 |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
449 stp = get (h, "textstep"); |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
450 t = [0, floor(cumsum(diff (lev)) / (abs(stp) - lvl_eps))]; |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
451 lvl = lev([true, t(1:end-1) != t(2:end)]); |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
452 set (h, "textlist", lvl); |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
453 else |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
454 lvl = get (h, "levellist"); |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
455 set (h, "textlist", lvl, "textstep", get (h, "levelstep")); |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
456 endif |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
457 |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
458 if (strcmpi (get (h, "showtext"), "on")) |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
459 switch (get (h, "zlevelmode")) |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
460 case "manual" |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
461 __clabel__ (get (h, "contourmatrix"), lvl, h, |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
462 get (h, "labelspacing"), get (h, "zlevel")); |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
463 case "auto" |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
464 __clabel__ (get (h, "contourmatrix"), lvl, h, |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
465 get (h, "labelspacing"), "auto"); |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
466 otherwise |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
467 __clabel__ (get (h, "contourmatrix"), lvl, h, |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
468 get (h, "labelspacing"), []); |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
469 endswitch |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
470 endif |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
471 endif |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
472 |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
473 recursive = false; |
ac7f334d9652
Add contour group objects and the clabel function
David Bateman <dbateman@free.fr>
parents:
8190
diff
changeset
|
474 endfunction |