Skip to content

Instantly share code, notes, and snippets.

@nozma
Created July 25, 2017 12:23
Show Gist options
  • Select an option

  • Save nozma/90444bae875c3c0b8a941ec495dbd7bc to your computer and use it in GitHub Desktop.

Select an option

Save nozma/90444bae875c3c0b8a941ec495dbd7bc to your computer and use it in GitHub Desktop.
デンドログラムのラベル操作や回転 ref: http://qiita.com/nozma/items/b6924a96f838f485f89b
data("UScitiesD")
hc <- hclust(UScitiesD)
plot(hc)
plot(hc, labels = 1:10)
plot(as.dendrogram(hc), horiz = TRUE)
hc$labels <- 1:10
plot(as.dendrogram(hc), horiz = TRUE)
de <- as.dendrogram(hc)
dendextend::labels(de) <- (1:10)[hc$order]
plot(de, horiz = TRUE)
w <- c("aaa", "aab", "aba", "bbb", "bab", "aaaa", "ccc", "abb", "ccccc")
plot(hclust(stringdist::stringdistmatrix(w, method = "dl")))
# dl: Damarau-Levenshtein距離
plot(hclust(stringdist::stringdistmatrix(w, method = "dl", useNames = "string")))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment