ggtree
ggtree copied to clipboard
Feature request: Density trees
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
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.
any progress and plan for PR @brj1 ?
I don't think I have anything to add to ggdensitree. However, I have hesitated adding ggdensitree as a PR for several reasons:
- It cannot handle very many trees due to the time need to run (and R's transparency not working well for low values).
- It's functionality can probably be added to ggtree or geom_tree directly.
The main features that ggdensitree adds are the following:
- Can align tips (taxa) of multiple trees (vertically and horizontally)
- Can plot (and fortify) a list() of trees
- 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.