Mercurial > hg > octave-lyh
comparison scripts/plot/private/__plt__.m @ 14431:f22a9555aa69
Fix 2D plotting of boolean values (bug #33607)
__plt__.m: Promote booleans to int8 values for plotting.
author | Rik <octave@nomad.inbox5.com> |
---|---|
date | Sun, 04 Mar 2012 13:57:42 -0800 |
parents | 72c96de7a403 |
children | 460a3c6d8bf1 |
comparison
equal
deleted
inserted
replaced
14430:df5488e46dca | 14431:f22a9555aa69 |
---|---|
175 endif | 175 endif |
176 | 176 |
177 [nr, nc] = size (x1); | 177 [nr, nc] = size (x1); |
178 if (nr == 1) | 178 if (nr == 1) |
179 x1 = x1.'; | 179 x1 = x1.'; |
180 tmp = nr; | 180 [nr, nc] = deal (nc, nr); # Swap rows and columns |
181 nr = nc; | 181 endif |
182 nc = tmp; | 182 if (iscomplex (x1)) |
183 endif | 183 x1_i = imag (x1); |
184 x1_i = imag (x1); | 184 if (any ((x1_i(:)))) |
185 if (any (any (x1_i))) | 185 x2 = x1_i; |
186 x2 = x1_i; | 186 x1 = real (x1); |
187 x1 = real (x1); | 187 else |
188 x2 = x1; | |
189 x1 = (1:nr)'; | |
190 endif | |
188 else | 191 else |
189 x2 = x1; | 192 x2 = x1; |
190 x1 = (1:nr)'; | 193 x1 = (1:nr)'; |
191 endif | 194 endif |
192 | 195 |
210 | 213 |
211 if (! isstruct (options)) | 214 if (! isstruct (options)) |
212 error ("__plt1__: options must be a struct array"); | 215 error ("__plt1__: options must be a struct array"); |
213 endif | 216 endif |
214 | 217 |
215 if (any (any (imag (x1)))) | 218 if (islogical (x1)) |
219 x1 = int8 (x1); | |
220 elseif (iscomplex ((x1))) | |
216 x1 = real (x1); | 221 x1 = real (x1); |
217 endif | 222 endif |
218 | 223 |
219 if (any (any (imag (x2)))) | 224 if (islogical (x2)) |
225 x2 = int8 (x2); | |
226 elseif (iscomplex (x2)) | |
220 x2 = real (x2); | 227 x2 = real (x2); |
221 endif | 228 endif |
222 | 229 |
223 h_set = false; | 230 h_set = false; |
224 if (isempty (x1) && isempty (x2)) | 231 if (isempty (x1) && isempty (x2)) |