[R-SIG-Mac] multi page png() plots with quartz driver

Stephen Eglen S.J.Eglen at damtp.cam.ac.uk
Wed Jul 16 23:32:53 CEST 2008


I came across the following bug in R 2.7.1 (installed from .dmg on
CRAN); I note that the help page for png does say the quartz support is
experimental, but just wanted to check whether this issue was known:

When drawing multi page plots, the 2nd page seems to remember some of
the first page, and so on...


png(file="hists_%03d.png")

for (i in 1:3) {
  par(mfrow=c(2,2))
  hist(rnorm(100*i), main='')
  hist(rnorm(100*i), main=paste('value of i is', i))
  hist(rnorm(100*i), main='')
  hist(rnorm(100*i), main='')
}

dev.off()


The fix I found to get the right plots was to change the png type:

png(file="hists_%03d.png", type='Xlib')

Stephen



More information about the R-SIG-Mac mailing list