【问题标题】:Naming the clusters in silhouette plot在剪影图中命名集群
【发布时间】:2015-11-04 03:20:25
【问题描述】:

我正在尝试命名轮廓图中的集群。有人能建议我如何命名每个剪影集群吗?

library(cluster)
data(ruspini)
pr4 <- pam(ruspini, 4)
str(si <- silhouette(pr4))
plot(si, col = c("red", "yellow", "blue", "purple"))# with cluster-wise coloring

【问题讨论】:

    标签: r plot ggplot2 cluster-analysis


    【解决方案1】:

    它无法更改,因为绘图上的名称是来自 si 中的列 cluster 的值,这是一个双精度矩阵。如果您强制此列,整个矩阵将强制输入 character,然后 silhouette 对象的 plot 函数将不起作用。

    library(cluster)
    data(ruspini)
    pr4 <- pam(ruspini, 4)
    str(si <- silhouette(pr4))
    plot(si, col = c("red", "yellow", "blue", "purple"))# 
    typeof(si)
    si
    

    【讨论】:

      猜你喜欢
      • 2021-05-20
      • 2021-11-15
      • 2012-06-15
      • 2018-12-13
      • 2019-01-04
      • 2020-05-12
      • 1970-01-01
      • 2021-01-15
      • 1970-01-01
      相关资源
      最近更新 更多