The returned Colors will be in dendrogram order.
leaf_Colors(d, col_to_return = c("edge", "node", "label"))
named character vector of Colors, NA_character_ where missing
slice,color_branches
dend <- USArrests %>%
dist() %>%
hclust(method = "ave") %>%
as.dendrogram()
d5 <- color_branches(dend, 5)
leaf_Colors(d5)
#> Florida North Carolina California Maryland Arizona
#> "#CC476B" "#CC476B" "#917600" "#917600" "#917600"
#> New Mexico Delaware Alabama Louisiana Illinois
#> "#917600" "#917600" "#917600" "#917600" "#917600"
#> New York Michigan Nevada Alaska Mississippi
#> "#917600" "#917600" "#917600" "#917600" "#917600"
#> South Carolina Washington Oregon Wyoming Oklahoma
#> "#917600" "#009232" "#009232" "#009232" "#009232"
#> Virginia Rhode Island Massachusetts New Jersey Missouri
#> "#009232" "#009232" "#009232" "#009232" "#009232"
#> Arkansas Tennessee Georgia Colorado Texas
#> "#009232" "#009232" "#009232" "#009232" "#009232"
#> Idaho Nebraska Kentucky Montana Ohio
#> "#008FB7" "#008FB7" "#008FB7" "#008FB7" "#008FB7"
#> Utah Indiana Kansas Connecticut Pennsylvania
#> "#008FB7" "#008FB7" "#008FB7" "#008FB7" "#008FB7"
#> Hawaii West Virginia Maine South Dakota North Dakota
#> "#A352D1" "#A352D1" "#A352D1" "#A352D1" "#A352D1"
#> Vermont Minnesota Wisconsin Iowa New Hampshire
#> "#A352D1" "#A352D1" "#A352D1" "#A352D1" "#A352D1"