YuLab-SMU / ggtree

:christmas_tree:Visualization and annotation of phylogenetic trees
https://yulab-smu.top/treedata-book/
830 stars 172 forks source link

Changed branch length(hclust) #556

Open mengchengyao opened 1 year ago

mengchengyao commented 1 year ago

Hello Thank you for your great tool. Now I am using gene expression to plot tree, and I find that the branch length aways to be same(First figure), I want to have different branch length of figure. 图片

hc <- hclust(dist(dat))
hc <- ape::as.phylo(hc)
ggtree( hc)

I checked the data and search google, unfortunately I did not find solution. 图片 as show figure, 2 < branch.length < 36 The branch.length value is greater 1, is it the key problem? How should I solve this problem?

Many thanks

xiangpin commented 1 year ago

Because the as.phylo of ape convert the hclust class to the same branch phylo class.

How about using ggtree(hclust class, layout = 'den') + theme_dendrogram() ?

You can refer to the PR https://github.com/YuLab-SMU/ggtree/pull/517