How to add multiple figures across multiple pages in a chunk using knitr and RMarkdown?
I am using a for loop to create multiple big figures across multiple pages in one chunk with knitr and rmarkdown. It works fine for word and html outputs, but has one problem in pdf output. This is a minimal RMarkdown example to reproduce my problem. --- title: "Knitr test" date: "6 April 2015" output: pdf_document --- ```{r, echo=FALSE, fig.width=6.5,fig.height=10} library(ggplot2) for (i in seq(1, 4)){ p <- ggplot(cars, aes(speed, dist)) + geom_point() print(p) } ``` The generated pdf file looks like this. Two figures are printed in the page. If I change the fig.height, add a few section in