diff scripts/plot/pareto.m @ 7228:685c186d8f62

[project @ 2007-11-30 16:43:12 by jwe]
author jwe
date Fri, 30 Nov 2007 16:43:13 +0000
parents 2636c0846924
children 86955a1559c5
line wrap: on
line diff
--- a/scripts/plot/pareto.m
+++ b/scripts/plot/pareto.m
@@ -68,7 +68,7 @@
       if (ischar (y))
 	y = cellstr (y);
       else
-	y = num2cell (y);
+	y = cellfun (@(x) num2str (x), num2cell (y), "UniformOutput", false);
       endif
     endif
   else
@@ -81,8 +81,8 @@
   cdf = cumsum (x);
   maxcdf = max(cdf);
   cdf = cdf ./ maxcdf;
-  [dummy, idx95] = min (abs (cdf - .95));
-  idx95 = idx95(1);
+  cdf95 = cdf - 0.95;
+  idx95 = find(sign(cdf95(1:end-1)) != sign(cdf95(2:end)))(1);
 
   [ax, hbar, hline] = plotyy (ax, 1 : idx95, x (1 : idx95), 
 			      1 : length(cdf), 100 .* cdf,