How to overlay density plots in R?

The Solution to How to overlay density plots in R? is


use lines for the second one:

plot(density(MyData$Column1))
lines(density(MyData$Column2))

make sure the limits of the first plot are suitable, though.

~ Answered on 2011-08-04 09:44:35


Most Viewed Questions: