I am trying to color code only the leaf node labels in a dendogram. I found this stackoverflow post which is the closest to what I am trying to do
Label and color leaf dendrogram
Tal Galili's answer is useful, but what would I need to do if I DIDN'T want the group labels to be attached to the leaf node labels, and just have the leaf node labels colored according to their group membership?
So using Galili's code,
sample = data.frame(matrix(floor(abs(rnorm(20000)*100)),ncol=200))
groupCodes <- c(rep("Cont",25), rep("Tre1",25), rep("Tre2",25),
rep("Tre3",25))
Instead of making the rownames unique based on the group label as such
rownames(sample) <- make.unique(groupCodes)
What if they were already all unique, e.g.
set.seed(123)
groupLabel <- rnorm(100,0,1)
rownames(sample) <- groupLabel
How would I keep the unique rownames as my node labels, and color them according to group membership (in this it would be the "groupCodes" in Galili's code)?