| 1 |
% Generated by roxygen2: do not edit by hand |
| 2 |
% Please edit documentation in R/attr_access.R |
| 3 |
\name{get_leaves_branches_attr} |
| 4 |
\alias{get_leaves_branches_attr} |
| 5 |
\title{Get an attribute of the branches of a dendrogram's leaves} |
| 6 |
\usage{ |
| 7 |
get_leaves_branches_attr(dend, attr = c("col", "lwd", "lty"), ...) |
| 8 |
} |
| 9 |
\arguments{ |
| 10 |
\item{dend}{a dendrogram object} |
| 11 |
|
| 12 |
\item{attr}{character, the attr to get. Can be either "col", "lwd", or "lty".} |
| 13 |
|
| 14 |
\item{...}{not used} |
| 15 |
} |
| 16 |
\value{ |
| 17 |
A vector with the dendrogram's leaves nodePar attribute |
| 18 |
} |
| 19 |
\description{ |
| 20 |
This is helpful to get the attributes of branches of the leaves. |
| 21 |
For example, after we use \link{color_branches}, to get the colors |
| 22 |
of the labels to match (since getting the colors of branches to match |
| 23 |
those of the labels can be tricky). |
| 24 |
This is based on \link{get_leaves_edgePar}. |
| 25 |
} |
| 26 |
\examples{ |
| 27 |
# define dendrogram object to play with: |
| 28 |
hc <- hclust(dist(USArrests[1:5, ]), "ave") |
| 29 |
dend <- as.dendrogram(hc) |
| 30 |
|
| 31 |
dend <- dend \%>\% |
| 32 |
color_branches(k = 3) \%>\% |
| 33 |
set("branches_lwd", c(2, 1, 2)) \%>\% |
| 34 |
set("branches_lty", c(1, 2, 1)) |
| 35 |
|
| 36 |
plot(dend) |
| 37 |
|
| 38 |
get_leaves_branches_attr(dend, "col") |
| 39 |
get_leaves_branches_attr(dend, "lwd") |
| 40 |
get_leaves_branches_attr(dend, "lty") |
| 41 |
|
| 42 |
labels_colors(dend) <- get_leaves_branches_attr(dend, "col") |
| 43 |
plot(dend) |
| 44 |
} |
| 45 |
\seealso{ |
| 46 |
\link{get_nodes_attr}, \link{assign_values_to_leaves_nodePar}, \link{labels_colors} |
| 47 |
\link{get_leaves_nodePar}, \link{get_leaves_edgePar} |
| 48 |
} |