如何创建“聚类图”阴谋 ? (在R中)
我遇到了这个有趣的网站,它提出了一种可视化聚类算法的想法,称为“ Clustergram":
(来源:schonlau.net)
我不确定这确实很有用,但为了使用它,我想用 R 重现它,但我不确定如何去做。
如何为每个项目创建一条线,以便它在不同数量的集群中保持一致?
这是一个示例代码/数据,可用于获取潜在答案:
hc <- hclust(dist(USArrests), "ave")
plot(hc)
I came across this interesting website, with an idea of a way to visualize a clustering algorithm called "Clustergram":
(source: schonlau.net)
I am not sure how useful this really is, but in order to play with it I would like to reproduce it with R, but am not sure how to go about doing it.
How would you create a line for each item so it would stay consistent throughout the different number of clusters?
Here is an example code/data to play with for potential answer:
hc <- hclust(dist(USArrests), "ave")
plot(hc)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
更新:我发布了一个解决方案,其中包含冗长的示例和讨论此处。 (它基于我下面给出的代码)。此外,Hadley 非常友善,并提供了代码的 ggplot2 实现。
这是一个基本的解决方案(为了更好的解决方案,请查看上面的“更新”):
Update: I posted a solution with a lengthy example and discussion here. (it is based on the code I gave bellow). Also, Hadley was very kind and offered a ggplot2 implementation of the code.
Here is a basic solution (for a better one, look at the "update" above):