Skip to content

Instantly share code, notes, and snippets.

@yuu-ito
Last active September 17, 2018 10:40
Show Gist options
  • Save yuu-ito/9360901 to your computer and use it in GitHub Desktop.
Save yuu-ito/9360901 to your computer and use it in GitHub Desktop.
require(graphics)
#?hclust
hc <- hclust(dist(USArrests), "ave")
# hc <- hclust(dist(USArrests), "complete")
# dist(USArrests)
plot(hc)
plot(hc, hang = -1)
plot(as.dendrogram(hc),horiz=TRUE) # 横向き
par(mar=c(3,1,0,9)) # 幅調整
plot(as.dendrogram(hc),horiz=TRUE)
library('dendextend')
dend <- color_branches(hc, k=3)
plot(dend,horiz=TRUE) # color

Rでデンドログラムのプロット

概要

  • データセットの作成(matrix,dist)
  • デンドログラム(樹形図)のプロット方法
  • グラフによる可視化

Rpubsにも投稿

参考にしたリンク

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment