从聚类图中删除点(factoextra)

Remove dots from cluster plot (factoextra)

有没有办法去掉factoextra包(factominer的绘图包)的fviz_cluster函数中的点。

如您所见,点有点乱,我想只保留聚类中心和椭圆体。

fviz_cluster(HCPC9CL, repel = FALSE, geom = "point", show.clust.cent = TRUE, ellipse.type = "norm", palette = trololo, ggtheme = theme_minimal(), main = "Factor map")

也许最简单的解决方案是设置 alpha = 0.

这是一个例子:

set.seed(123)
data(iris)
iris.scaled <- scale(iris[, -5])
km.res <- kmeans(iris.scaled, 3, nstart = 10)


fviz_cluster(km.res, iris[, -5],
             repel = FALSE,
             geom = "point",
             show.clust.cent = TRUE,
             ellipse.type = "norm",
             ggtheme = theme_minimal(),
             main = "Factor map",
             alpha = 0)

不过我建议不要去掉这些点,而是把它们做成透明的,只用颜色来区分:

fviz_cluster(km.res, iris[, -5],
             repel = FALSE,
             geom = "point",
             show.clust.cent = TRUE,
             ellipse.type = "norm",
             ggtheme = theme_minimal(),
             main = "Factor map",
             alpha = 0.2,
             shape = 19)