Debian Codegraph @

man/assign_values_to_nodes_nodePar.Rd

raw
1 % Generated by roxygen2: do not edit by hand
2 % Please edit documentation in R/attr_access.R
3 \name{assign_values_to_nodes_nodePar}
4 \alias{assign_values_to_nodes_nodePar}
5 \title{Assign values to nodePar of dendrogram's nodes}
6 \usage{
7 assign_values_to_nodes_nodePar(
8 dend,
9 value,
10 nodePar = c("pch", "cex", "col", "xpd", "bg"),
11 warn = dendextend_options("warn"),
12 ...
13 )
14 }
15 \arguments{
16 \item{dend}{a dendrogram object}
17
18 \item{value}{a new value vector for the nodePar attribute. It should be
19 the same length as the number of nodes in the tree. If not, it will recycle
20 the value and issue a warning.}
21
22 \item{nodePar}{the value inside nodePar to adjust.
23 This may contain components named pch, cex, col, xpd, and/or bg.}
24
25 \item{warn}{logical (default from dendextend_options("warn") is FALSE).
26 Set if warning are to be issued, it is safer to keep this at TRUE,
27 but for keeping the noise down, the default is FALSE.}
28
29 \item{...}{not used}
30 }
31 \value{
32 A dendrogram, after adjusting the nodePar attribute in all of its nodes,
33 }
34 \description{
35 Go through the dendrogram nodes and updates the values inside its nodePar
36
37 If the value has Inf then the value in edgePar will not be changed.
38 }
39 \examples{
40
41 \dontrun{
42
43 dend <- USArrests[1:5, ] \%>\%
44 dist() \%>\%
45 hclust("ave") \%>\%
46 as.dendrogram()
47
48 # reproduces "labels_colors<-"
49 # although it does force us to run through the tree twice,
50 # hence "labels_colors<-" is better...
51 plot(dend)
52 dend2 <- dend \%>\%
53 assign_values_to_nodes_nodePar(value = 19, nodePar = "pch") \%>\%
54 assign_values_to_nodes_nodePar(value = c(1, 2), nodePar = "cex") \%>\%
55 assign_values_to_nodes_nodePar(value = c(2, 1), nodePar = "col")
56 plot(dend2)
57
58
59 ### Making sure this works for NA with character.
60 dend \%>\%
61 assign_values_to_nodes_nodePar(value = 19, nodePar = "pch") \%>\%
62 assign_values_to_nodes_nodePar(value = c("red", NA), nodePar = "col") -> dend2
63 plot(dend2)
64 }
65
66 }
67 \seealso{
68 \link{get_leaves_attr}, \link{assign_values_to_leaves_nodePar}
69 }