12.17 椭圆图
type 指定多元分布的类型,type = "t"
和 type = "norm"
分别表示 t 分布和正态分布,geom = "polygon"
,以 eruptions > 3
分为两组
ggplot(faithful, aes(x = waiting, y = eruptions)) +
geom_point() +
stat_ellipse()
ggplot(faithful, aes(waiting, eruptions, color = eruptions > 3)) +
geom_point() +
stat_ellipse(type = "norm", linetype = 2) +
stat_ellipse(type = "t") +
theme(legend.position = "none")
ggplot(faithful, aes(waiting, eruptions, fill = eruptions > 3)) +
stat_ellipse(geom = "polygon") +
theme(legend.position = "none")