Debian Codegraph @

man/branches_attr_by_labels.Rd

raw
1 % Generated by roxygen2: do not edit by hand
2 % Please edit documentation in R/branches_attr_by.R
3 \name{branches_attr_by_labels}
4 \alias{branches_attr_by_labels}
5 \title{Change col/lwd/lty of branches matching labels condition}
6 \usage{
7 branches_attr_by_labels(
8 dend,
9 labels,
10 TF_values = c(2, Inf),
11 attr = c("col", "lwd", "lty"),
12 type = c("all", "any"),
13 ...
14 )
15 }
16 \arguments{
17 \item{dend}{a dendrogram dend}
18
19 \item{labels}{a character vector of labels from the tree}
20
21 \item{TF_values}{a two dimensional vector with the TF_values to use in case a branch fulfills the condition (TRUE)
22 and in the case that it does not (FALSE). Defaults are 2/Inf for col, lwd and lty.
23 (so it will insert the first value, and will not change all the FALSE cases)}
24
25 \item{attr}{a character with one of the following values: col/lwd/lty}
26
27 \item{type}{a character vector of either "all" or "any", indicating which of
28 the branches should be painted: ones that all of their labels belong to the supplied labels,
29 or also ones that even some of their labels are included in the labels vector.}
30
31 \item{...}{ignored.}
32 }
33 \value{
34 A dendrogram with modified branches (col/lwd/lty).
35 }
36 \description{
37 The user supplies a dend, labels, and type of condition (all/any), and TF_values
38 And the function returns a dendrogram with branches col/lwd/lty accordingly
39 }
40 \examples{
41 \dontrun{
42
43 library(dendextend)
44
45 set.seed(23235)
46 ss <- sample(1:150, 10)
47
48 # Getting the dend dend
49 dend <- iris[ss, -5] \%>\%
50 dist() \%>\%
51 hclust() \%>\%
52 as.dendrogram()
53 dend \%>\% plot()
54
55 dend \%>\%
56 branches_attr_by_labels(c("123", "126", "23", "29")) \%>\%
57 plot()
58 dend \%>\%
59 branches_attr_by_labels(c("123", "126", "23", "29"), "all") \%>\%
60 plot() # the same as above
61 dend \%>\%
62 branches_attr_by_labels(c("123", "126", "23", "29"), "any") \%>\%
63 plot()
64
65 dend \%>\%
66 branches_attr_by_labels(
67 c("123", "126", "23", "29"),
68 "any", "col", c("blue", "red")
69 ) \%>\%
70 plot()
71 dend \%>\%
72 branches_attr_by_labels(
73 c("123", "126", "23", "29"),
74 "any", "lwd", c(4, 1)
75 ) \%>\%
76 plot()
77 dend \%>\%
78 branches_attr_by_labels(
79 c("123", "126", "23", "29"),
80 "any", "lty", c(2, 1)
81 ) \%>\%
82 plot()
83 }
84 }
85 \seealso{
86 \link{noded_with_condition}, \link{get_leaves_attr}, \link{nnodes}, \link{nleaves}
87 }