This is a upgrade of the basic dendrogram presented in the figure #29. Please refer to this previous post to understand how a dendrogram works.

In this exemple, we just show how to add specific colors to leaves and sample name. It permits to check if the expected groups are indeed logical.

The beginning of the code is the same as graph #29.

We can now create a basic dendrogram:

Actually, each leaf of the tree has several attributes, like the color, the shape … You can take back these attributes and look at them like that :

So if I Want to color each leaf of the Tree, I have to change the attributes of each leaf. This can be done using the dendrapply function. So I create a function that add 3 attributes to the leaf : one for the color (“lab.col”) ,one for the font “lab.font” and one for the size (“lab.cex”).

Finally I just have to apply this to my dendrogram

Not what you are looking for ? Make a new search !



Leave a Reply

Notify of