I have now incorporated all of these methods into the phytools function densityTree which I have also completely re-written. More information can be seen on my blog here: http://blog.phytools.org/2017/04/complete-re-write-of-phytools.html.

The function is already in phytools which can be installed from GitHub using devtools.

- Liam

Liam J. Revell, Associate Professor of Biology
University of Massachusetts Boston
web: http://faculty.umb.edu/liam.revell/
email: liam.rev...@umb.edu
blog: http://blog.phytools.org

On 4/26/2017 12:18 PM, Vojtěch Zeisek wrote:
Yes, it helps and makes the tree in good scale. Just branches of one tree do
not reach the right edge like the others. And tip labels are still missing.

Dne středa 26. dubna 2017 18:52:04 CEST jste napsal(a):
Oops. ylim should be c(0,Ntip(trees[[1]])) rather than c(0,11) (that was
specific to the 10 taxon case. Let me know if that helps.

On 4/26/2017 11:48 AM, Vojtěch Zeisek wrote:
Liam, thank You very much! It is what I was looking for. Unfortunately, I
have problem with Your solution 4 and onward (attached). Previous 3
solutions worked as expected. Some trees were unrooted, rooting did not
help. Branch lengths were variable, but all were ultrametric. Also I
don't see why tip labels are missing.
I'd also add one more information. Incongruent nodes use to have low
support among trees. I'd like to display support below e.g. 90 in color
of respective tree and some offset not to overlap.

print.phylo(x=hirta[[1]], details=TRUE) # Other trees are similar...

Phylogenetic tree with 28 tips and 27 internal nodes.

Tip labels:
        O._engleriana, O._odorata, O._versicolor, O._zeyheri, O._fibrosa,

O._ciliaris, ...

Node labels:
        , NA, 100.0, 100.0, 99.0, 100.0, ...

Rooted; includes branch lengths.
## What I did:
# Vertical offset
hirta.ylim <- c(0, Ntip(hirta[[1]])+1)
# Get depths of the tree
hirta.h <- sapply(hirta, function(x) max(nodeHeights(x)))
# Test plot the longest tree to get the maximum x dimension
plotTree(hirta[[which(hirta.h==max(hirta.h))]], direction="leftwards")
hirta.xlim <- get("last_plot.phylo", envir=.PlotPhyloEnv)$x.lim
# Set tip order based on a majority rule consensus tree
hirta.tips <- setNames(1:Ntip(hirta[[1]]), untangle(consensus(hirta,
p=0.5), "read.tree")$tip.label)
# Set colors
hirta.colors <- rainbow(n=length(hirta))
# Plot our trees
for(i in 1:length(hirta)) {

  hirta.y.shift <- (i-median(1:length(hirta)))/length(hirta)/2
  plotTree(hirta[[i]], color=make.transparent(hirta.colors[i], 0.4),

tips=hirta.tips+hirta.y.shift, add=i>1, direction="leftwards",
xlim=hirta.xlim[2:1], mar=c(4.1, 1.1, 1.1, 1.1), nodes="inner",
ftype=if(i==median(1:length(hirta))) "i" else "off", ylim=c(0, 11))

  if(i==1) axis(1)


Dne středa 26. dubna 2017 15:29:45 CEST jste napsal(a):
Hi Vojtech.

I just posted a handful of different possible solutions using phytools
on my blog:
http://blog.phytools.org/2017/04/showing-multiple-conflicting.html. Let
me know if any of them work for you.

All the best, Liam

On 4/25/2017 12:20 PM, Vojtěch Zeisek wrote:
for comparison of two trees I can use very nice function cophyloplot
plotting two trees (left and right) and connecting respective nodes by
lines. Very nice and convenient to read. But only for two trees.
Displaying multiple trees in multiple comparisons is not very
To display dozens to hundreds of trees there is densitree. Also nice,
for this purpose I don't like its display.
I have several trees (~5) and I wish to compare their topologies, show
supports (at least for differing nodes) and highlight differences. I
thought about some overlay/parallel plotting (similar to the attached
image) where there would be complete topologies displayed and
incongruences would be easily visible. It would be probably doable by
plotting all separate trees by plot.phylo and then combining and tuning
the figure in some vector editor (like Inkscape). But I hope there is
some more automated way to do it. :-) Sincerely,

R-sig-phylo mailing list - R-sig-phylo@r-project.org
Searchable archive at http://www.mail-archive.com/r-sig-phylo@r-project.org/

R-sig-phylo mailing list - R-sig-phylo@r-project.org
Searchable archive at http://www.mail-archive.com/r-sig-phylo@r-project.org/

Reply via email to