title: How to rotate one plot out of many when using knitr?
body: <p>I am using knitr with plots. I would like to rotate one of them 90 degree. For example:</p>
  
  <pre><code>\documentclass{article}
  
  \begin{document}
  
  
  &lt;&lt;cache=TRUE, echo=FALSE, message=FALSE, warning=FALSE, comment=NA, eval=TRUE, results=asis&gt;&gt;=
  
  library("ggplot2")
  library("gridExtra")
  
  func &lt;- function(data,x,y) {
  
    p1 &lt;- ggplot(data.frame(data), aes(x = x, y = y)) + geom_point()
    p2 &lt;- ggplot(data.frame(data), aes(x = x, y = y)) + geom_point()
    p3 &lt;- ggplot(data.frame(data), aes(x = x, y = y)) + geom_point()
    p4 &lt;- ggplot(data.frame(data), aes(x = x, y = y)) + geom_point()
  
    grid.newpage() 
      pushViewport(viewport(width = .9, height = .9,layout = grid.layout(nrow=2, ncol=2)))
      print(p1,vp = viewport(layout.pos.row = 1, layout.pos.col = 1))
      print(p2,vp = viewport(layout.pos.row = 2, layout.pos.col = 1))
      print(p3,vp = viewport(layout.pos.row = 1, layout.pos.col = 2))
      print(p4,vp = viewport(layout.pos.row = 2, layout.pos.col = 2))
  
    grid.newpage() 
      pushViewport(viewport(width = .8, height = .5,layout = grid.layout(nrow=1, ncol=2)))
      print(p1,vp = viewport(layout.pos.row = 1, layout.pos.col = 1))
      print(p2,vp = viewport(layout.pos.row = 1, layout.pos.col = 2))
  
  }
  
  x &lt;- runif(20,0,1)
  y &lt;- rnorm(20)
  test &lt;- cbind(x,y)
  func(test,x=test$x,y=test$y)
  
  @    
  
  \end{document}
  </code></pre>
  
  <p>I would like to rotate both the second page and the graph 90 degree. I know I can use this for one page:</p>
  
  <pre><code>\usepackage{pdflscape}
  \begin{landscape}
  ....
  \end{landscape}
  </code></pre>
  
  <p>But the two plots are arranged by grid.newpage() within one function. How can I achieve that? Thanks a lot!</p>