Closed DarioS closed 8 years ago
works as intended, in standard grid you're supposed to explicitly call grid.newpage()
if you want grid.draw()
to draw on a blank page, i.e. the default behaviour is to add things to the page, not assume that we want to erase what was there before and replace it.
ggplot2, in contrast, has always gone in the other direction. Its recently-added grid.draw
method is just a wrapper around print.ggplot
, which defaults to newpage=TRUE
.
Note that grid.arrange
(somewhat inconsistently) also defaults to newpage=TRUE
, so you could use that instead.
Shouldn't the PDF document have two pages, not one page with two overlaid plots ?
If I use
grid.draw
on the boxplot and violin plot separately, I get a 2 page PDF, as desired.It seems that
arrangeGrob
is the cause of the problem.