from http://www.statmethods.net/graphs/density.html
# Filled Density Plot
d <- density(mtcars$mpg)
plot(d, main="Kernel Density of Miles Per Gallon")
polygon(d, col="red", border="blue")
I used it in a context as follows: See "lookAtResults.FUNCTIONS.R"
d = density(par.old)
plot(d, xlim=xlims, main = plotTitle, xlab=xlab)
polygon(d, col=rgb(.5,0,.5,.5))
polygon(density(par.new), col=rgb(0,0,0,.2))
legend("topright", legend=c("old model","new model"), lty=1, lwd=3, col=c(rgb(.5,0,.5,.8), rgb(0,0,0,.4)))