gpt4 book ai didi

从聚类图中删除点(factoextra)

转载 作者:行者123 更新时间:2023-12-02 20:26:00 25 4
gpt4 key购买 nike

有没有办法从factoextra包(facminer的绘图包)的fviz_cluster函数中删除点。

enter image description here

正如您所看到的,这些点有点困惑,我想仅保留簇中心和椭球体。

fviz_cluster(HCPC9CL, repel = FALSE, geom = "point", show.clust.cent = TRUE, ellipse.type = "norm", Palette = trololo, ggtheme = theme_minimal(),
main =“因子图”)

最佳答案

也许最简单的解决方案是设置 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)

enter image description here

但是我建议不要删除这些点,而是使它们透明,并仅使用颜色来区分它们:

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)

enter image description here

关于从聚类图中删除点(factoextra),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49935865/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com