0

I have a simple question. When we would like to remove the first blank page for an individual plot, we set

pdf("abc.pdf", onefile=FALSE)

However, when we are plotting using lapply, setting onefile=FALSE will only print the last plot.

I wonder how we solve this? Thanks!

kin182
  • 393
  • 6
  • 13
  • [See here](https://stackoverflow.com/q/5963269/5325862) on making a reproducible example that is easier for folks to help with. It's unclear what this blank page is, why there are multiple pages of plots, or what code you're running exactly that's causing the issue – camille May 18 '21 at 00:43

1 Answers1

1

When I tried this code on a Linux box running R 4.0.4 it produced five one page pdf files:

for(i in 1:5){ pdf(file=paste0("x",i, '.pdf')); plot(1,1); dev.off()}

If this doesn't succeed on your setup, then you need to describe it better.

I then tried for completeness:

lapply(1:5, function(y){pdf(file=paste0("xx",y, '.pdf')); plot(1,1); dev.off() })
# same results
IRTFM
  • 258,963
  • 21
  • 364
  • 487