Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plotting circular and fan trees: root length and "vertical" branch layout #95

Open
RaSieb opened this issue Nov 16, 2016 · 5 comments
Open

Comments

@RaSieb
Copy link

RaSieb commented Nov 16, 2016

I am using ggtree for circular / fan tree images and would like to create publishable images. I have two major issues:

  1. 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?
  2. 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

@RaSieb
Copy link
Author

RaSieb commented Nov 16, 2016

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:
t

@GuangchuangYu
Copy link
Member

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.

@RaSieb
Copy link
Author

RaSieb commented Nov 17, 2016

Thanks a lot, r2 = r + xlim(-5, NA) solves issue 1 perfectly.

Any idea about issue 2 ?

@GuangchuangYu
Copy link
Member

GuangchuangYu commented Nov 17, 2016

issue 2 is not an issue, the segments are not straight. them seem to be straight since they are short.

@RaSieb
Copy link
Author

RaSieb commented Nov 17, 2016

could the radius then be adjusted, so several segments join nicely into one bow?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants