View source: R/branches_attr_by.R
branches_attr_by_lists | R Documentation |
The user supplies a dend, lists, and type of condition (all/any), and TF_values And the function returns a dendrogram with branches col/lwd/lty accordingly
branches_attr_by_lists(
dend,
lists,
TF_values = c(2, 1),
attr = c("col", "lwd", "lty"),
...
)
dend |
a dendrogram dend |
lists |
a list where each element contains the labels of members in selected nodes down to which the branches shall be adapted |
TF_values |
a two dimensional vector with the TF_values to use in case a branch fulfills the condition (TRUE) and in the case that it does not (FALSE). Defaults are 2/1 for col, lwd and lty. (so it will insert the first value, and will not change all the FALSE cases) |
attr |
a character with one of the following values: col/lwd/lty |
... |
ignored. |
A dendrogram with modified branches (col/lwd/lty).
branches_attr_by_labels
## Not run:
library(dendextend)
set.seed(23235)
ss <- sample(1:150, 10)
# Getting the dend dend
dend <- iris[ss, -5] %>%
dist() %>%
hclust() %>%
as.dendrogram()
dend %>% plot()
# define a list of nodes
L <- list(c("109", "123", "126", "145"), "29", c("59", "67", "97"))
dend %>%
branches_attr_by_lists(L) %>%
plot()
# choose different color, and also change lwd and lty
dend %>%
branches_attr_by_lists(L, TF_value = "blue") %>%
branches_attr_by_lists(L, attr = "lwd", TF_value = 4) %>%
branches_attr_by_lists(L, attr = "lty", TF_value = 3) %>%
plot()
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.