R语言ggplot2::geom_density绘制概率密度图
diamonds 是内置数据集library
(ggplot2)
ggplot(diamonds, aes(carat)) +
geom_density()
ggplot(diamonds, aes(depth, colour = cut)) + geom_density() + xlim(55, 70)
更多示例: https://ggplot2.tidyverse.org/reference/geom_density.html#examples