This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Force same scale on different phylogenetic trees

I am using R and ggtree to create phylogenetic trees. I would like to force the same treescale on two different trees to make it easier to compare them (As of now, one scale is at 0.001 while the other is at 0.003).

Is there a function to change this, so that the branch lengths are adjusted to a similar scale in both trees? geom_treescale in ggtree only place the treescale on the tree and doesn't change the branch lengths. Maybe it is possible to normalize the branch lengths somehow?

r

Please post the code, example data and expected output.

1 answer

I just read your question as I am having the same problem at the moment. Assuming we are really having the same trouble and I am not still totally lost. Anyway, I could find a way to do it.

I directly imported my trees into R in the nwk format. Now you need to make a list of your tree files as followed;

trees=list(tree1, tree2, tree3) class(trees) = "multiPhylo"

And you are done. You can just use facet_wrap with scales fixed and can define the tree scale with geom_treescale

ggtree(trees) + facet_wrap(~.id, scales="fixed") + geom_treescale(width = 0.1)

I hope my answer will help another total beginner like me with R who is struggling:)

Cheers

Log in to answer this question.