talgalili / dendextend

Extending R's Dendrogram Functionality
152 stars 28 forks source link

how to color tip or branch based on an external data.frame with name corresponding to tip labels? #77

Open tboonf opened 6 years ago

tboonf commented 6 years ago

I have been trying a few other dendogram plotting programs and have been pleased with the flexibility of dendextend when used with ggplot. I am having difficulty in combining workflow with phyloseq. Phyloseq offers the flexibility of performing unifrac and h.clustering, after which the result can be plotted in ggplot.

GPUF<-UniFrac(physeq, weighted = FALSE) GP.hclust <- hclust(GPUF, method = "average") dend <- as.dendrogram(GP.hclust) ggplot(dend, horiz = T)

Can one passes the grouping info to dendextend so that the tip or branch can be color according to group? Name group A aaa B aaa C bbb D ccc