【问题标题】:Coordinate Plot for Clustering Visualitzation/Analysis聚类可视化/分析的坐标图
【发布时间】:2016-06-24 05:56:18
【问题描述】:

我有一个数据集(已经缩放),总共包含 8 列:

  • 第一列表示每个观察所属的分配集群,
  • 和 7 个因变量(每个变量在不同的列中)。

我想通过 R 中的坐标图开发聚类可视化,就像下面的博客 (http://blog.datascienceheroes.com/short-lesson-on-cluster-analysis/) 中所示。

谁能帮我解决这个问题?

【问题讨论】:

    标签: r plot graph cluster-analysis hclust


    【解决方案1】:

    许多选项。你可以这样做

    library(GGally)
    ggparcoord(aggregate(mtcars, list(as.factor(cutree(hclust(dist(mtcars)), k = 4))), mean), columns=-1, groupColumn=1)
    

    library(parcoords)
    parcoords(
      aggregate(mtcars, list(cutree(hclust(dist(mtcars)), k = 4)), mean),
      color = list( colorScale = htmlwidgets::JS('d3.scale.category10()'), colorBy = "Group.1")
    )
    parcoords(
      transform(mtcars, cluster = cutree(hclust(dist(mtcars)), k = 4)),
      color = list( colorScale = htmlwidgets::JS('d3.scale.category10()'), colorBy = "cluster")
    )
    

    【讨论】:

      【解决方案2】:

      你有你需要的功能的代码(plot_clus_coord)here

      【讨论】:

        猜你喜欢
        • 2011-01-22
        • 1970-01-01
        • 2022-07-28
        • 2021-10-04
        • 1970-01-01
        • 2020-03-15
        • 1970-01-01
        • 1970-01-01
        • 2016-01-29
        相关资源
        最近更新 更多