岭线图1
岭线图又称山脉图,可用来观察一个连续变量在不同组中的分布情况。
安装并载入R包。
install.packages("ggridges")
library(ggridges)
library(ggplot2) # 需安装install.packages("ggplot2")
ggplot(diamonds, aes(x = price, y = cut, colour = cut)) +
geom_density_ridges(fill = "transparent") +
theme_bw()
2023-02-22 16:59