【问题标题】:Remove dots from cluster plot (factoextra)从聚类图中删除点(事实额外)
【发布时间】:2018-09-30 19:55:19
【问题描述】:

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

如您所见,这些点有点乱,我想只保留集群中心和椭球体。

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

【问题讨论】:

    标签: r plot cluster-analysis


    【解决方案1】:

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

    【讨论】:

    • 我根本没想过透明度!谢谢楼主!
    • 在我的情节中,我想摆脱标签,但即使我设置了labelsize = 0,它们仍然存在。
    猜你喜欢
    • 1970-01-01
    • 2012-06-01
    • 2012-07-27
    • 2018-11-24
    • 2010-10-23
    • 2016-09-30
    • 1970-01-01
    • 2015-08-09
    • 1970-01-01
    相关资源
    最近更新 更多