Add dotted line between tree branch tips and outside ring in a circular tree

156 views
Skip to first unread message

Legana Fingerhut

unread,
Jun 27, 2023, 10:35:57 PM6/27/23
to ggtree
Hello,

I am trying to add lines between the tips of my tree and the outside ring in a circular tree and I do not want to display my tip labels. I know I can add a dotted line using `geom_tiplab2` and setting the `align` parameter to TRUE, but that still shows the tip labels (even if I set the size to 0, they become tiny but visible). Does anyone know a better way please? Please see my below example code and associated plot:

library(tidyverse)
library(ggtree)
library(ggtreeExtra)
set.seed(1024)
tr <- rtree(100)
dd = data.frame(id=tr$tip.label, value=abs(rnorm(100)))
dt = data.frame(id=tr$tip.label, group=c(rep("A",50),rep("B",50)))
ddt = left_join(dd, dt)

ggtree(tr, layout="circular") +
  geom_fruit(data = ddt,
             geom = geom_col,
             mapping = aes(x=value, y= id, fill=group)) +
  geom_tiplab2(size = 0, align = TRUE)




example.png

gc...@connect.hku.hk

unread,
Jun 30, 2023, 11:33:22 AM6/30/23
to Legana Fingerhut, ggtree
This can be easy. 

Just: 

+ geom_tiplab(align = TRUE, aes(label = ""))





------ 原始信息 ------
来自 "'Legana Fingerhut' via ggtree" <bioc-...@googlegroups.com>
收件人 "ggtree" <bioc-...@googlegroups.com>
日期 2023/6/28 10:35:57
主题 Add dotted line between tree branch tips and outside ring in a circular tree

--
1. Data Integration, Manipulation and Visualization of Phylogenetic Trees (1st ed.). Chapman and Hall/CRC. 2022. ISBN: 9781032233574
2. ggtreeExtra: Compact visualization of richly annotated phylogenetic data. Molecular Biology and Evolution. 2021, 38(9):4039-4042. doi: 10.1093/molbev/msab166
3. Using ggtree to visualize data on tree-like structures. Current Protocols in Bioinformatics. 2020, 69:e96. doi: 10.1002/cpbi.96
4. 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
5. Two methods for mapping and visualizing associated data on phylogeny using ggtree. Molecular Biology and Evolution, 2018, 35(2):3041-3043. doi: 10.1093/molbev/msy194
6. 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
---
You received this message because you are subscribed to the Google Groups "ggtree" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bioc-ggtree...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/bioc-ggtree/70718fa8-7b22-46c7-a1aa-7ef61750722cn%40googlegroups.com.

Legana Fingerhut

unread,
Jul 2, 2023, 9:17:40 PM7/2/23
to ggtree
Beautiful! 

Thanks so much!

Reply all
Reply to author
Forward
0 new messages