[R] blank pdf output when called in a loop

Nicolas STRANSKY stransky at BroadInstitute.org
Wed Jul 21 01:02:30 CEST 2010


Hi,

I'm hitting a strange problem where pdf plots that I'm trying to make
are blank, only when produced from within a loop. The pdf contains 0 page.
I've narrowed the problem to this minimal script that invariably
produces an empty pdf with my setup:
pdf("/local/scratch/1.pdf", width=8, height=8)
for (k in 1) {
  wireframe(volcano)
}
dev.off()

The odd thing is that
pdf("/local/scratch/1.pdf", width=8, height=8)
  wireframe(volcano)
dev.off()
works fine!

Am I doing something wrong here? I've tried on two different systems,
Linux or Mac.

Thanks,
    Nico


R version 2.11.0 (2010-04-22)
x86_64-unknown-linux-gnu

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C
LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8     LC_MONETARY=C

 [6] LC_MESSAGES=en_US.UTF-8    LC_PAPER=en_US.UTF-8       LC_NAME=C
              LC_ADDRESS=C               LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base

other attached packages:
[1] lattice_0.18-5 custom_1.1

loaded via a namespace (and not attached):
[1] grid_2.11.0

-- 
Nicolas STRANSKY, Ph.D.
Computational Biologist, Cancer Program
Broad Institute of MIT and Harvard
5CC-1339  |  7 Cambridge Center  |  Cambridge, MA  02142, USA
Phone: +1 617 714 7564           |    nico at BroadInstitute.org



More information about the R-help mailing list