[Phylobase-devl] What I did with my summer vacation -- phylobase plotting

Peter Cowan pdc at berkeley.edu
Sat Aug 9 08:40:58 CEST 2008

>>> - Oddly, the 'treePlot(geospiza, tip.plot.fun = 'density')' example seems
>>> to
>>> have a weird bug. In successive calls of the same example, the density
>>> plots
>>> shift between the correct place at the tips and appearing half way down
>>> the
>>> tree. Even odder, I only get this behaviour in a Quartz window - it plots
>>> correctly to a pdf for both calls, as you can see!
>> I tried to replicate this, e.g. calling treePlot(geospiza,
>> tip.plot.fun = 'density') several times in a row and couldn't get it
>> on my quartz window, strange.  If you see it again, could you save the
>> window and send it to me?  Sounds kinda like a quartz bug.
> I can't now replicate it! I will keep an eye out for a recurrence and copy
> it to you if I see it...

Hopefully, it doesn't come up again!

> On a new question - how do these functions cope with multiple plots on a
> page. I tried using par(mfrow=c(2,1))  before plotting the density plots and
> found that the tree plots across both panels but the density plots respect
> the plot division. See below for a demonstration - probably best to avoid
> mfrow and mfcol with grid graphics, I guess!

Ah, yes, this is going to be one of the gotchas, of using treePlot,
grid happily ignores all par() settings.  However, if you're using a
gridBase call, like density, or the hist function I sent in reply to
Thibaut, then those plots look at par.

The safe way to get side by side plots is to use the grid.layout(),
note this will only work with the latest version in SVN.
Unfortunately, not nearly as compact or easy to understand as calling
par() or layout.  On the upside it allows the inclusion of trees in
more complicated plots than base graphics do.

mylayout <- grid.layout(ncol = 2)
pushViewport(viewport(layout = mylayout))
    pushViewport(viewport(layout.pos.col = 1))
    treePlot(geospiza, newpage = FALSE, tip.plot.fun = 'density')
pushViewport(viewport(layout.pos.col = 2))
    treePlot(geospiza, newpage = FALSE, tip.plot.fun = 'density')


More information about the Phylobase-devl mailing list