Hi Elizabeth, I ran into a similar problem recently (with another package) and a simple solution that worked for me is to call par(new=TRUE) before your plot=TRUE plot. So something like:

pdf('test.pdf') plot(tree, plot=FALSE) par(new=TRUE) plot(tree, plot=TRUE) dev.off() HTH Best, Rafael Maia — Junior Fellow, Simons Society of Fellows Rubenstein Lab, Columbia University Department of Ecology, Evolution and Environmental Biology New York, NY http://www.rafaelmaia.net > On Sep 26, 2017, at 9:03 AM, Emmanuel Paradis <emmanuel.para...@ird.fr> wrote: > > Hi Elizabeth, > > You can use directly the functions behind the calculations of the > coordinates; they are documented together: ?node.depth. But this will not > give the final coordinates since more calculations are needed depending on > the widths of the labels, etc. > > Another possibility could be to plot the tree in a temporary file and get the > settings afterwards, eg: > > R> tmpf <- tempfile() > R> pdf(tmpf) > R> plot(rtree(100)) > R> dev.off() > X11cairo > 2 > R> lastPP <- get("last_plot.phylo", envir = .PlotPhyloEnv) > R> lastPP > $type > [1] "phylogram" > .... > > R> unlink(tmpf) # optional since it's deleted when R is closed > > Just for the record, if some users wonder about the usefulness of the option > plot=FALSE, see some examples in: > > example(phydataplot) > > HTH > > Best, > > Emmanuel > > Le 26/09/2017 à 14:58, Elizabeth Purdom a écrit : >> Hello, >> I am writing a function that calls plot.phylo in the ape package with the >> option plot=FALSE. I then do some calculations with the output (the >> calculated coordinates), and then make another call to plot.phylo with >> plot=TRUE. If I do this, then the plot=FALSE option creates a blank plot, >> which is the result that is clearly documented in the help pages. >> However, I do not want this blank plot, because I am saving the result (the >> second call to plot.phylo) to a pdf, and so the pdf has a blank page before >> the plot I want. And since I’m calling this in a function, I can’t “wait” >> for the second plot (a similar problem occurs if you run it in a knitr >> document) >> Is there a way to get the output from plot.phylo with all of the >> coordinates, etc. without having to have the blank plot? (I do not want an >> option to “add” the plot to the blank plot, if it exists, because I am doing >> these calculations so that in my next call I can change the x.lim options so >> the tree only takes up a fraction of the plot, so I need to reset the par, >> etc., and not just draw on the original coordinates set up by the blank plot) >> Thank you, >> Elizabeth Purdom >> Pour nous remonter une erreur de filtrage, veuillez vous rendre ici : >> http://f.security-mail.net/302lu3ZCAL7 >> > > _______________________________________________ > 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/ [[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/