Created
July 25, 2017 12:23
-
-
Save nozma/90444bae875c3c0b8a941ec495dbd7bc to your computer and use it in GitHub Desktop.
デンドログラムのラベル操作や回転 ref: http://qiita.com/nozma/items/b6924a96f838f485f89b
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| data("UScitiesD") | |
| hc <- hclust(UScitiesD) | |
| plot(hc) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| plot(hc, labels = 1:10) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| plot(as.dendrogram(hc), horiz = TRUE) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| hc$labels <- 1:10 | |
| plot(as.dendrogram(hc), horiz = TRUE) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| de <- as.dendrogram(hc) | |
| dendextend::labels(de) <- (1:10)[hc$order] | |
| plot(de, horiz = TRUE) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| w <- c("aaa", "aab", "aba", "bbb", "bab", "aaaa", "ccc", "abb", "ccccc") | |
| plot(hclust(stringdist::stringdistmatrix(w, method = "dl"))) | |
| # dl: Damarau-Levenshtein距離 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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