[R] how to add an edgetext to a dendrogram?

Sarah Goslee sarah.goslee at gmail.com
Fri Dec 9 13:10:32 CET 2011


Hi,

On Fri, Dec 9, 2011 at 6:57 AM, barbara costa <rbarbarahc at gmail.com> wrote:
> Hello to all,
> I'd like to colour the different labels of my dendrogram. How can I do? I
> guess I could to using *edgetext* and then* t.col* or *lab.col* but I don't
> know how to add edgetext to my dendrogram. Can you help me please?
>
> Example:
>
> require(graphics); require(utils)
>
> hc <- hclust(dist(USArrests), "ave")
> plot(dend1)
> labels (USArrests) [[1]] # to know how many cities (labels) = 50


> require(graphics); require(utils)
>
> hc <- hclust(dist(USArrests), "ave")
> plot(dend1)
Error in plot(dend1) : object 'dend1' not found

What's dend1?

> nP <- list(col=3:2, cex=c(2.0, 0.75), pch= 21:22,
>           bg= c("light blue", "pink"),
>           lab.cex = 0.75, lab.col = 1:50) # or use a palette:
> palette(rainbow(50))
>
> plot(dend1, edgePar=nP, dLeaf=1, edge.root = TRUE)
>
> # this option is not correct. I want each of my labels (text) have a
> different colour but that is not what is happening. How can I do that?
>
> I'd appreciate your help.
> thanks a lot
> Barbara
>


-- 
Sarah Goslee
http://www.functionaldiversity.org



More information about the R-help mailing list