Mercurial > hg > octave-lyh
changeset 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 | df5488e46dca |
children | e053d1622f4e |
files | scripts/plot/private/__plt__.m |
diffstat | 1 files changed, 16 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/plot/private/__plt__.m +++ b/scripts/plot/private/__plt__.m @@ -177,14 +177,17 @@ [nr, nc] = size (x1); if (nr == 1) x1 = x1.'; - tmp = nr; - nr = nc; - nc = tmp; + [nr, nc] = deal (nc, nr); # Swap rows and columns endif - x1_i = imag (x1); - if (any (any (x1_i))) - x2 = x1_i; - x1 = real (x1); + if (iscomplex (x1)) + x1_i = imag (x1); + if (any ((x1_i(:)))) + x2 = x1_i; + x1 = real (x1); + else + x2 = x1; + x1 = (1:nr)'; + endif else x2 = x1; x1 = (1:nr)'; @@ -212,11 +215,15 @@ error ("__plt1__: options must be a struct array"); endif - if (any (any (imag (x1)))) + if (islogical (x1)) + x1 = int8 (x1); + elseif (iscomplex ((x1))) x1 = real (x1); endif - if (any (any (imag (x2)))) + if (islogical (x2)) + x2 = int8 (x2); + elseif (iscomplex (x2)) x2 = real (x2); endif