title: In R, how to prevent blank page in pdf when using gridBase to embed subplot inside plot
body: <p>As explained <a href="https://stackoverflow.com/a/7795594/597069">here</a>, it is easy to embed a plot into an existing one thanks to <code>gridBase</code>, even though both plots use the base graphics system of R. However, when saving the whole figure into a pdf, the first page is always blank. How to prevent this?</p>
  
  <p>Here is an example:</p>
  
  <pre><code>require(gridBase)
  
  ## generate dummy data
  set.seed(1859)
  x &lt;- 1:100
  y &lt;- x + rnorm(100, sd=5)
  ols &lt;- lm(y ~ x)
  
  pdf("test.pdf")
  
  ## draw the first plot
  plot.new() # blank page also happens when using grid.newpage()
  pushViewport(viewport())
  plot(x, y)
  
  ## draw the second plot, embedded into the first one
  pushViewport(viewport(x=.75,y=.35,width=.2,height=.2,just=c("center","center")))
  par(plt=gridPLT(), new=TRUE)
  hist(ols$residuals, main="", xlab="", ylab="")
  popViewport(2)
  
  dev.off()
  </code></pre>