Mercurial > octave
diff scripts/plot/private/__pie__.m @ 11341:3c7ba1e3dc21
Add missing option slice for pie and pie3
author | Kai Habel <kai.habel@gmx.de> |
---|---|
date | Fri, 10 Dec 2010 19:53:06 +0100 |
parents | 892ef3688ccf |
children | fd0a3ac60b0e |
line wrap: on
line diff
--- a/scripts/plot/private/__pie__.m Fri Dec 10 09:09:49 2010 +0100 +++ b/scripts/plot/private/__pie__.m Fri Dec 10 19:53:06 2010 +0100 @@ -61,8 +61,17 @@ explode = zeros (size (x)); endif + normalize = true; + if (sum (x(:)) < 1) + normalize = false; + endif + if (! have_labels) - xp = round (100 * x ./ sum (x)); + if (normalize) + xp = round (100 * x ./ sum (x)); + else + xp = round (100 * x); + endif for i = 1:len labels{i} = sprintf ("%d%%", xp(i)); endfor @@ -71,7 +80,12 @@ hlist = []; refinement = 90; phi = 0:refinement:360; - xphi = cumsum (x / sum (x) * 360); + if (normalize) + xphi = cumsum (x / sum (x) * 360); + else + xphi = cumsum (x * 360); + endif + for i = 1:len if (i == 1) xn = 0 : 360 / refinement : xphi(i);