Hi Jacob.

This is surprising easy. Check out the solution here: http://blog.phytools.org/2015/03/splitting-tree-across-multiple-pages.html.

You may find that, as in this example, some things like node & edge labels are split across pages - in which case you can fiddle with the split positions & replot the tree until it is the way you want it.

All the best, Liam

Liam J. Revell, Assistant 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 3/5/2015 2:24 PM, Jacob Berv wrote:
Hi Liam,

Would there be a way to modify this so that annotations like node labels and 
axes could be applied to both 1/2s of a split tree at the same time? I’ve been 
struggling with a similar problem using plot.phylo() and we can get our tree to 
look like what we want on one page, but splitting it up while keeping node and 
branch annotations etc is problematic.

For example, I am trying to plot a tree and annotate with the following 
function calls.

#from ape
plot.phylo(timetree, cex=0.315, label.offset=0.35, edge.width=1.25, 
edge.color=color)

#from phyloch - adds a geologic time scale
axisGeo(GTS = strat2012, unit = c("epoch", "period"), cex = 0.7, col = c("grey80", "white"), texcol 
= "black", gridty = 2, gridcol = "red", ages=TRUE)

#then additional annotations with:
nodelabels()
axis()

I want to cut my tree in 1/2 and plot each 1/2 on a separate page, but maintain 
the axes and annotations. Splitting a tree is great but it’s not super useful 
unless you can call other functions on the pieces. It would be great to be able 
to generate axes for each piece of a split tree independently and then annotate 
each one as if they were a separate plot.

Jake



On Mar 5, 2015, at 11:46 AM, Jonas Eberle <eberle.jo...@gmail.com> wrote:

Hi Liam,

perfect! Your right, I didn't realize that some species were duplicated.
Great to have the option in phytools!

All the best,
Jonas


2015-03-05 17:16 GMT+01:00 Liam J. Revell <liam.rev...@umb.edu>:

Hi Jonas.

I thought of the same thing. Unfortunately, one thing that I discovered is
that because R automatically adds 4% or so to the plotting range, you will
find that species & edges near the bottom of one page will also appear at
the top of the next page. If you test your code & look for species or edges
near the bottom or top of each page, you may find what I did.

I have posted a solution to this here: http://blog.phytools.org/2015/
03/splitting-tree-over-mutiple-plotting.html. It uses plotTree from
phytools internally, but it could fairly easily be modified to use other
tree plotters such as plot.phylo or plotSimmap.

All the best, Liam

Liam J. Revell, Assistant 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 3/5/2015 5:19 AM, Jonas Eberle wrote:

MultipagePhyloPlot <- function (tree, npages = 5) {
   ntips <- length(tree$tip.label)
   tips.per.page <- ntips / npages
   y1 <- ntips - tips.per.page
   y2 <- ntips
   for (i in 1:npages) {
     plot.phylo(tree, y.lim = c(y1, y2))
     y1 <- y1 - tips.per.page
     y2 <- y2 - tips.per.page
   }
}



        [[alternative HTML version deleted]]

_______________________________________________
R-sig-phylo mailing list - R-sig-phylo@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-phylo
Searchable archive at http://www.mail-archive.com/r-sig-phylo@r-project.org/

Jacob Berv

Ph.D. Student
Lovette Lab
Cornell Laboratory of Ornithology


_______________________________________________
R-sig-phylo mailing list - R-sig-phylo@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-phylo
Searchable archive at http://www.mail-archive.com/r-sig-phylo@r-project.org/

Reply via email to