I'll be honest, the code to do this in R is substantially more non-intuitive. Nice work Mike!
On Tuesday, November 10, 2015 at 12:51:32 PM UTC-5, milktrader wrote: > > > The solution to the two-color problem is ... >> > > using Winston, KernelDensity > > k = kde(rand(100)) > > k1 = k.x[k.x .< .5]; > > k2 = k.x[k.x .> .5]; > > f1 = FillBelow(k1, k.density[1:length(k1)], color="blue"); > > f2 = FillBelow(k2, k.density[length(k1)+1:end], color="red"); > > p = FramedPlot() > > add(p, f1, f2) > > > <https://lh3.googleusercontent.com/-IZGoutLSGZo/VkIubnP-htI/AAAAAAAACJQ/lRrZ1hBze9E/s1600/Screen%2BShot%2B2015-11-10%2Bat%2B12.50.17%2BPM.png> > >