[R] Color individual leaf labels in dendrogram

Bryan Hanson hanson at depauw.edu
Fri Oct 15 15:24:34 CEST 2010


Henrik, there is an easily adaptable example in this thread:
http://r.789695.n4.nabble.com/coloring-leaves-in-a-hclust-or-dendrogram-plot
-tt795496.html#a795497

HTH. Bryan
*************
Bryan Hanson
Professor of Chemistry & Biochemistry
DePauw University, Greencastle IN USA



On 10/15/10 9:05 AM, "Kennedy" <henrik.aldberg at gmail.com> wrote:

> 
> Hi,
> 
> I have performed a clustering of a matrix and plotted the result with
> pltree. See code below. I want to color the labels of the leafs
> individually. For example I want the label name "Node 2" to be plotted in
> red. How do I do this?
> 
> Sincerely 
> 
> Henrik
> 
> 
>   library(cluster)
> 
>   D <- matrix(nr=4,nc=4)
>   rownames(D) <- c("Node 1","Node 2","Node 3","Node 4")
>   D[1,] <- c(0,.6,.1,.7)
>   D[2,] <- c(.6,.0,.3,.9)
>   D[3,] <- c(.1,.3,0,.9)
>   D[4,] <- c(.7,.9,.9,0)
> 
>   C <- agnes(D,diss=T,method="complete")
> 
>   pltree(C)



More information about the R-help mailing list