library(ggplot2)
set.seed(1)
vals1 <- rbeta(1000, 0.5, 0.1)
vals2 <- rbeta(1000, 0.25, 0.3)
gg <- ggplot(data.frame(x=c(vals1, vals2),
grp=c(rep("a", 1000), rep("b", 1000))))
gg <- gg + geom_density(aes(x=x, y=..scaled.., fill=grp), alpha=1/2)
gg <- gg + theme_bw()
gg