File:Dend12.png: Difference between revisions
Jump to navigation
Jump to search
({{Pre}} set.seed(123) dat <- matrix(rnorm(20), ncol=2) # perform hierarchical clustering hc <- hclust(dist(dat)) # plot dendrogram plot(hc) # get ordering of leaves ord <- order.dendrogram(as.dendrogram(hc)) ord # [1] 8 3 6 5 10 1 9 7 2 4 # Same as seen on the dendrogram nodes # Rotate the branches (1,9) & (7,2,4) plot(rotate(hc, c("8", "3", "6", "5", "10", "7", "2", "4", "1", "9")), main="Rotated") </pre>) |
|||
Line 18: | Line 18: | ||
# Rotate the branches (1,9) & (7,2,4) | # Rotate the branches (1,9) & (7,2,4) | ||
plot(rotate(hc, c("8", "3", "6", "5", "10", "7", "2", "4", "1", "9")), main="Rotated") | plot(rotate(hc, c("8", "3", "6", "5", "10", "7", "2", "4", "1", "9")), main="Rotated") | ||
# OR move (8:10) in front of (6:7) | |||
plot(rotate(hc, c(1,2,3,4,5,8:10,6:7)), main='Rotate2') | |||
</pre> | </pre> |
Latest revision as of 13:17, 13 August 2023
Summary
set.seed(123) dat <- matrix(rnorm(20), ncol=2) # perform hierarchical clustering hc <- hclust(dist(dat)) # plot dendrogram plot(hc) # get ordering of leaves ord <- order.dendrogram(as.dendrogram(hc)) ord # [1] 8 3 6 5 10 1 9 7 2 4 # Same as seen on the dendrogram nodes # Rotate the branches (1,9) & (7,2,4) plot(rotate(hc, c("8", "3", "6", "5", "10", "7", "2", "4", "1", "9")), main="Rotated") # OR move (8:10) in front of (6:7) plot(rotate(hc, c(1,2,3,4,5,8:10,6:7)), main='Rotate2')
File history
Click on a date/time to view the file as it appeared at that time.
Date/Time | Thumbnail | Dimensions | User | Comment | |
---|---|---|---|---|---|
current | 16:17, 12 August 2023 | 876 × 448 (11 KB) | Brb (talk | contribs) | {{Pre}} set.seed(123) dat <- matrix(rnorm(20), ncol=2) # perform hierarchical clustering hc <- hclust(dist(dat)) # plot dendrogram plot(hc) # get ordering of leaves ord <- order.dendrogram(as.dendrogram(hc)) ord # [1] 8 3 6 5 10 1 9 7 2 4 # Same as seen on the dendrogram nodes # Rotate the branches (1,9) & (7,2,4) plot(rotate(hc, c("8", "3", "6", "5", "10", "7", "2", "4", "1", "9")), main="Rotated") </pre> |
You cannot overwrite this file.
File usage
The following page uses this file: