# NOT RUN {
# Simpledensity plot
data("mtcars")
ggdensity(mtcars, x = "mpg", fill = "red") +
scale_x_continuous(limits = c(-1, 50)) +
stat_overlay_normal_density(color = "red", linetype = "dashed")
# Color by groups
data(iris)
ggdensity(iris, "Sepal.Length", color = "Species") +
stat_overlay_normal_density(aes(color = Species), linetype = "dashed")
# Facet
ggdensity(iris, "Sepal.Length", facet.by = "Species") +
stat_overlay_normal_density(color = "red", linetype = "dashed")
# }
Run the code above in your browser using DataLab