我正在使用 ggdendrogram 来绘制树状图,但我希望在左侧添加标签以使图表更直观。我该怎么做呢?谢谢!!!
library(ggplot2)
library(ggdendro)
### Data
countries <- c("UK","AU","SA","CH")
distmatrix <- matrix(c(0.00, 0.16, 1.01, 0.97, 0.16, 0.00, 0.84, 0.79, 1.01, 0.84, 0.00, 1.49, 0.97, 0.79, 1.49, 0.00),
nrow=4,dimnames=list(countries, countries))
### Cluster
hc = hclust(as.dist(distmatrix), method = "ward")
### Plot
ggdendrogram(hc, rotate=TRUE, theme_dendro=FALSE)