R语言 如何在ggplot2中显示stat_ellipse中心点

icnyk63a  于 2023-02-17  发布在  其他
关注(0)|答案(1)|浏览(145)

ggplot2如何显示stat_ellipse中的中心点?或者用其他方式,如何根据相关矩阵(2列)计算该点的坐标?
我不知道ggplot2中是否可以完成,或者只能事先计算这一点。

ccrfmcuu

ccrfmcuu1#

我不明白你为什么要中心点,但这能解决你的问题吗?

library(tidyverse)

ggplot(faithful, aes(waiting, eruptions)) +
  geom_point() +
  stat_ellipse() +
  stat_ellipse(level = 0.0001, geom = "point", color = "red")

创建于2023年2月14日,使用reprex v2.0.2

相关问题