ePo*_*PoQ 2 plot r cluster-analysis
有没有办法从fviz_clusterfactoextra 包(factominer 的绘图包)的函数中删除点。
正如你所看到的,这有点乱,我想只保留聚类中心和椭球。
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)
Run Code Online (Sandbox Code Playgroud)
但是我建议不要删除这些点,而是使它们透明,并且仅使用颜色来区分它们:
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)
Run Code Online (Sandbox Code Playgroud)