YuLab-SMU / ggtree

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

supporting linewidth and size in geom_tree #574

Closed xiangpin closed 1 year ago

xiangpin commented 1 year ago

https://github.com/YuLab-SMU/ggtree/issues/552

> library(ggtree)
ggtree v3.9.0 For help: https://yulab-smu.top/treedata-book/

If you use the ggtree package suite in published research, please cite
the appropriate paper(s):

Guangchuang Yu, David Smith, Huachen Zhu, Yi Guan, Tommy Tsan-Yuk Lam.
ggtree: an R package for visualization and annotation of phylogenetic
trees with their covariates and other associated data. Methods in
Ecology and Evolution. 2017, 8(1):28-36. doi:10.1111/2041-210X.12628

Guangchuang Yu, Tommy Tsan-Yuk Lam, Huachen Zhu, Yi Guan. Two methods
for mapping and visualizing associated data on phylogeny using ggtree.
Molecular Biology and Evolution. 2018, 35(12):3041-3043.
doi:10.1093/molbev/msy194

LG Wang, TTY Lam, S Xu, Z Dai, L Zhou, T Feng, P Guo, CW Dunn, BR
Jones, T Bradley, H Zhu, Y Guan, Y Jiang, G Yu. treeio: an R package
for phylogenetic tree input and output with richly annotated and
associated data. Molecular Biology and Evolution. 2020, 37(2):599-603.
doi: 10.1093/molbev/msz240
> data(iris)
> 
> p1 <- hclust(dist(iris[,-5])) %>% ggtree()
> p2 <- hclust(dist(iris[,-5])) %>% ggtree(branch.length='none')
> p1 / p2

捕获

> library(ggplot2)
> library(aplot)
> aplot::plot_list(gglist=list(linewidth_0.1=f1, size_2=f2, linewidth_2=f3, size_0.1=f4, aes.size=f5, aes.linewidth=f6), nrow=3)

捕获

xiangpin commented 1 year ago
> hclust(dist(iris[,-5])) %>% ggtree(branch.length='none', linewidth = .1) -> f1
> hclust(dist(iris[,-5])) %>% ggtree(branch.length='none', size = 2) -> f2
> hclust(dist(iris[,-5])) %>% ggtree(branch.length='none', linewidth = 2) -> f3
> hclust(dist(iris[,-5])) %>% ggtree(branch.length='none', size = .1) -> f4
> hclust(dist(iris[,-5])) %>% ggtree(branch.length='none', aes(size = branch.length)) -> f5
> hclust(dist(iris[,-5])) %>% ggtree(branch.length='none', aes(linewidth = branch.length)) -> f6