我将数据集分为 4 组:groups = taxabylevel。我运行 ggbiplot 并在每个组周围添加椭圆。如何添加每个椭圆的中心?
g <- ggbiplot(pca, obs.scale = 1, var.scale = 1, alpha=0, groups = taxaBylevel,show_guide = FALSE, ellipse = TRUE)
print(g)
data(iris)
pca<-prcomp(iris[,1:4],scale=T)
g<-ggbiplot(pca, obs.scale = 1, var.scale = 1, alpha=0, groups = iris[,5],show_guide = FALSE, ellipse = TRUE)
gmean=aggregate(g$data[,1:2],list(group=g$data$group),mean)
ggbiplot(pca, obs.scale = 1, var.scale = 1, alpha=0, groups = iris[,5],show_guide = FALSE, ellipse = TRUE)+
geom_point(data=gmean,aes(group=group,colour=group))