Imagine I have two vectors each of different length. I want to generate one plot with the density of both vectors overlaid. What I thought I should do is this:
Try this if you want have legends too:
df <- rbind(data.frame(x=rnorm(2000, 0, 1), vec='1'), data.frame(x=rnorm(3000, 1, 1.5), vec='2')) ggplot(df, aes(x, group=vec, col=vec)) + geom_density(position='dodge')