[R] png()/jpeg()

Wilkinson, Mark Mark.Wilkinson at stjude.org
Fri Jan 31 21:13:03 CET 2003

When I execute the following code, it works just like I want it to: three
pages of nine (or fewer) plots.  However, when I execute the code with the
first and last lines uncommented, I get three pages (files), but the 2nd &
3rd pages have overlapping plots.  It's like a new page wasn't created.  

I'm pretty sure I've either misplaced or left out a crucial call to some
function, but I'm not sure where. Please help.

#png(width=937, height=703, pointsize=15)
for (i in seq(1, 24, 9)) {
  par(mfrow=c(3, 3))
  for (gt in i:min((i+8), 24)) {
    for (j in 1:20) { 
      lines(density(rnorm(1000)), lty=4, col="gray")


Mark Wilkinson
Informatics Analyst
St. Jude Children's Research Hospital
Department of Pharmaceutical Sciences

The opinions expressed here are my own and do not necessarily represent
those of St. Jude Children's Research Hospital.

More information about the R-help mailing list