Get the nodePar attributes of dendrogram's leaves (includes pch, color, and cex)

get_leaves_nodePar(dend, simplify = FALSE, ...)

Arguments

dend

a dendrogram object

simplify

logical (default is FALSE). If TRUE, then the return vector is after using unlist on it.

...

not used

Value

A list (or a vector) with the dendrogram's leaves nodePar attribute

Examples

# define dendrogram object to play with:
hc <- hclust(dist(USArrests[1:3, ]), "ave")
dend <- as.dendrogram(hc)

# get_leaves_attr(dend) # error :)
get_leaves_nodePar(dend)
#> [[1]]
#> [1] NA
#> 
#> [[2]]
#> [1] NA
#> 
#> [[3]]
#> [1] NA
#> 
labels_colors(dend) <- 1:3
get_leaves_nodePar(dend)
#> [[1]]
#> [[1]]$lab.col
#> [1] 1
#> 
#> [[1]]$pch
#> [1] NA
#> 
#> 
#> [[2]]
#> [[2]]$lab.col
#> [1] 2
#> 
#> [[2]]$pch
#> [1] NA
#> 
#> 
#> [[3]]
#> [[3]]$lab.col
#> [1] 3
#> 
#> [[3]]$pch
#> [1] NA
#> 
#> 

dend <- assign_values_to_leaves_nodePar(dend, 2, "lab.cex")
get_leaves_nodePar(dend)
#> [[1]]
#> [[1]]$lab.col
#> [1] 1
#> 
#> [[1]]$pch
#> [1] NA
#> 
#> [[1]]$lab.cex
#> [1] 2
#> 
#> 
#> [[2]]
#> [[2]]$lab.col
#> [1] 2
#> 
#> [[2]]$pch
#> [1] NA
#> 
#> [[2]]$lab.cex
#> [1] 2
#> 
#> 
#> [[3]]
#> [[3]]$lab.col
#> [1] 3
#> 
#> [[3]]$pch
#> [1] NA
#> 
#> [[3]]$lab.cex
#> [1] 2
#> 
#> 

plot(dend)