how could I make a legend representing all the curves that are plotted in my graph ? Presently, an automatic legend is generated for the first layer (based on the "colour" aesthetic), but the other layer (the black curve representing the density of "price" variable across all observations) in not contained in this legend.
I conceive that my question comes certainly from an incomplete understanding of the concepts behing ggplot package.
ggplot(diamonds) +
geom_density(aes(x = price, y = ..density.., colour = cut)) +
geom_density(aes(x = price,y = ..density..))