Displaying 1 result from an estimated 1 matches for "lab_color".
Did you mean:
fb_color
2011 Sep 26
0
horizontal labels for a dendrogram
...of a dataset with a
dendrogram. I'm using the following script:
data = read.table("data.csv", header=T, sep=";")
require(cluster)
res = as.dendrogram(agnes(data))
chlab <- function(n) {
if(is.leaf(n)) {
att <- attributes(n)
labx <- data$category1[att$label]
lab_color <- ifelse(labx == "A", "black", ifelse(labx == "B", "red",
"green"))
attr(n, "nodePar") <- c(att$nodePar, lab.col = lab_color, pch = NA)
attr(n, "label") <- labx
}
n
}
# lab.col = lab_color,
res2 = dendrapply(res,...