ggtree
ggtree copied to clipboard
Plotting circular and fan trees: root length and "vertical" branch layout
I am using ggtree for circular / fan tree images and would like to create publishable images. I have two major issues:
- When a tree has short branch lenghts close to the root, the tree is hardly readable (especially when plotting tip labels). In FigTree, there is a parameter called "Root Length", which can be very usefull to increase readibility of the tree by moving all nodes and branches further out and closer together. Is there a way to do this in ggtree?
- The circular "branches" (vertical in square plot) are plotted as a number of straight segments instead of real circle fragments (see around node 84 in example tree below). This is disturbing for the reader. Is there a way to get around this?
I use a random tree for illustration:
set.seed(6464); t <- rtree(60); r <- ggtree(t, layout="fan", open.angle=1); r + theme_tree() + geom_text2(aes(label=node, subset=!isTip), color="red");
tree_out_pdf.pdf
One solution to no. 1 would be to align the tip labels. However, this would not increase readibility of the tree itself.
Thanks a lot for your help in advance! R
sorry to comment on my own post, but would like to let you know this:
ape:::plot.phylo(t, root.edge=T) can do it using the t$root.edge component in the phylo class. But plot.phylo of cours has some restrictions, why I would like to use ggtree. Could it be an option to add that in ggtree?
with the example above:
t$root.edge <- 8 ape:::plot.phylo(t, root.edge = T, "fan")
results in:

I think you want to produce something like Figure 1 and 2 in https://www.ncbi.nlm.nih.gov/pubmed/27605062, which were generated by ggtree.
The answer was already posted in google forum.
Thanks a lot, r2 = r + xlim(-5, NA) solves issue 1 perfectly.
Any idea about issue 2 ?
issue 2 is not an issue, the segments are not straight. them seem to be straight since they are short.
could the radius then be adjusted, so several segments join nicely into one bow?