-2

I have R script which creates 100 plots.
How to create 1 single PDF with 50 pages?
2 plots on each page.I tried using
par(mfrow=(50,2))
but its giving Error in plot.new() : figure margins too large

Roland
  • 127,288
  • 10
  • 191
  • 288

1 Answers1

5

you want 2 plots per page, so you need par(mfrow=c(2,1)). R will automatically switch to the next page if you ask it to plot more than 2 plots.

pdf("myoutput.pdf")
par(mfrow=c(2,1))
for (i in 1:100) {
  plot(runif(10)
}

should produce a 50 pages pdf, with 2 plots per page.

xraynaud
  • 2,028
  • 19
  • 29