Mercurial > hg > octave-nkf
comparison scripts/plot/__patch__.m @ 7276:1e8e64d71e34
[project @ 2007-12-10 20:09:59 by jwe]
author | jwe |
---|---|
date | Mon, 10 Dec 2007 20:09:59 +0000 |
parents | a730e47fda4d |
children | fb902b3b2a5d |
comparison
equal
deleted
inserted
replaced
7275:c099705f1aa7 | 7276:1e8e64d71e34 |
---|---|
139 endif | 139 endif |
140 else | 140 else |
141 error ("patch: not supported"); | 141 error ("patch: not supported"); |
142 endif | 142 endif |
143 | 143 |
144 h = __go_patch__ (p); | |
145 ax = get (h, "parent"); | |
146 | |
147 cargs = {}; | 144 cargs = {}; |
148 if (have_c) | 145 if (have_c) |
149 if (ischar (c)) | 146 if (ischar (c)) |
150 cargs{1} = "facecolor"; | 147 cargs{1} = "facecolor"; |
151 cargs{2} = c; | 148 cargs{2} = c; |
158 elseif (isnumeric (c)) | 155 elseif (isnumeric (c)) |
159 cargs{1} = "facecolor"; | 156 cargs{1} = "facecolor"; |
160 cargs{2} = "flat"; | 157 cargs{2} = "flat"; |
161 cargs{3} = "cdata"; | 158 cargs{3} = "cdata"; |
162 cargs{4} = c; | 159 cargs{4} = c; |
163 clim = get (ax, "clim"); | |
164 if (c(1) < clim(1)) | |
165 set (ax, "clim", [c(1), clim(2)]) | |
166 clim(1) = c(1); | |
167 endif | |
168 if (c(1) > clim(2)) | |
169 set (ax, "clim", [clim(1), c(1)]) | |
170 endif | |
171 else | 160 else |
172 error ("patch: color value not valid"); | 161 error ("patch: color value not valid"); |
173 endif | 162 endif |
174 elseif (size (c, ndims (c)) == 3) | 163 elseif (size (c, ndims (c)) == 3) |
175 cargs{1} = "facecolor"; | 164 cargs{1} = "facecolor"; |
176 cargs{2} = "flat"; | 165 cargs{2} = "flat"; |
177 cargs{3} = "cdata"; | 166 cargs{3} = "cdata"; |
178 cargs{4} = c; | 167 cargs{4} = c; |
179 else | 168 else |
180 ## Color Vectors | 169 ## Color Vectors |
181 | |
182 if (rows (c2) != rows (x) || rows (c2) != length (y)) | 170 if (rows (c2) != rows (x) || rows (c2) != length (y)) |
183 error ("patch: size of x, y, and c must be equal") | 171 error ("patch: size of x, y, and c must be equal") |
184 else | 172 else |
185 cargs{1} = "facecolor"; | 173 cargs{1} = "facecolor"; |
186 cargs{2} = "interp"; | 174 cargs{2} = "interp"; |
187 if (abs(max(c2(:)) - min(c2(:))) < eps) | |
188 set (ax, "clim", [c2(1)-1, c2(1)+1]) | |
189 else | |
190 set (ax, "clim", [min(c2(:)), max(c2(:))]); | |
191 endif | |
192 endif | 175 endif |
193 endif | 176 endif |
194 else | 177 else |
195 cargs{1} = "facecolor"; | 178 cargs{1} = "facecolor"; |
196 cargs{2} = [0, 1, 0]; | 179 cargs{2} = [0, 1, 0]; |
197 endif | 180 endif |
198 | 181 |
199 set (h, "xdata", x, "ydata", y, "faces", faces, "vertices", vert, | 182 h = __go_patch__ (p, "xdata", x, "ydata", y, "faces", faces, |
200 cargs{:}, varargin{iarg:end}); | 183 "vertices", vert, cargs{:}, varargin{iarg:end}); |
201 if (have_z) | 184 if (have_z) |
202 set (h, "zdata", z); | 185 set (h, "zdata", z); |
203 endif | 186 endif |
204 | 187 |
205 endfunction | 188 endfunction |