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

Feature request: Density trees #134

Open
jorgeamaya opened this issue Jun 19, 2017 · 3 comments
Open

Feature request: Density trees #134

jorgeamaya opened this issue Jun 19, 2017 · 3 comments

Comments

@jorgeamaya
Copy link

Hi!
I'm trying to emulate DensiTree plots using ggtree. It is clear that ggtree can't generate trees like this at the moment: https://pbs.twimg.com/media/CNn5DgkWIAAQxmC.jpg .

I tried plotting all the trees at the same time but the outcome was a tree in which all the tips were aligned at different distances.

library(ape) library(ggtree) tree = read.tree("all_par.tree") #A file with many trees p <- ggtree(tree, layout="slanted", branch.length='none', color="lightblue", alpha=.3,) + geom_tiplab(cex=1) p

Could you try to implement this in the future? Thanks

@brj1
Copy link
Contributor

brj1 commented Nov 14, 2017

I've implemented a prototype for this in my fork: brj1/ggtree

You can make DensiTree like plots with my fork of ggtree with

library(ape)
library(ggtree)
tree = read.tree("all_par.tree") #A file with many trees
p <- ggdensitree(tree, layout="slanted", branch.length='none', color="lightblue", alpha=.3,) + geom_tiplab(cex=1)
p

EDIT: Upon @GuangchuangYu 's suggestion I have renamed ggmultitree to ggdensitree to avoid confusion with the multiPhylo class.

@GuangchuangYu
Copy link
Member

any progress and plan for PR @brj1 ?

@brj1
Copy link
Contributor

brj1 commented Aug 9, 2019

I don't think I have anything to add to ggdensitree. However, I have hesitated adding ggdensitree as a PR for several reasons:

  1. It cannot handle very many trees due to the time need to run (and R's transparency not working well for low values).
  2. It's functionality can probably be added to ggtree or geom_tree directly.

The main features that ggdensitree adds are the following:

  1. Can align tips (taxa) of multiple trees (vertically and horizontally)
  2. Can plot (and fortify) a list() of trees
  3. Can jitter placement the trees

To my knowledge multiPhylo objects are plotted with the roots aligned and the tips (taxa) ordered individually so that the tips at the same y values may not correspond to the same taxon in different trees. These were the main reasons why I wrote the ggdensitree function in the first place. Again, it may be better to just add this functionality into preexisting ggtree functions.

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

3 participants