[R] more mulitpage postscript problems

Wilkinson, Mark Mark.Wilkinson at stjude.org
Fri Feb 21 20:47:03 CET 2003


I posted a while ago about 'overlap' problems using png/jpeg.  If what
Patrick Connolly suggests is truly happening, I think the following may be

My new problem is with the following code (the overlap is still there if I
use png() instead of postscript(), compounded by the difficulty described

tmp <- matrix(runif(16000), nrow=16)
for (i in seq(1, 16, 4)) {
  par(mfrow=c(2, 2))
  for (j in 1:min(i+3, 16)) {
    plot(density(tmp[j, ], from=0, to=1), lwd=3, main=paste(i, j))

When I run as is, I get what I want: four 'pages', 4 plots each.  But when I
comment X11(), and uncomment the first and last lines, the postscript file I
get has 10 pages!

Could someone kindly point out what I'm doing wrong?  Thank you,

> version
platform i686-pc-linux-gnu
arch     i686
os       linux-gnu
system   i686, linux-gnu
major    1
minor    6.1
year     2002
month    11
day      01
language R

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.

 -----Original Message-----
From: 	Patrick Connolly [mailto:p.connolly at hortresearch.co.nz] 
Sent:	Sunday, February 02, 2003 4:49 PM
To:	Wilkinson, Mark
Subject:	Re: [R] png()/jpeg()

On Fri, 31-Jan-2003 at 02:12PM -0600, Wilkinson, Mark wrote:

|> 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
|> 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.  

It works if you use a postscript device to create a multipage
postscript file.  I think the bitmap procedure, in fact, creates one
and uses ImageMagick to make the bitmap file/s.  Looks like a job for
Brian to work out where the problem is.

Until then, you can quite simply make a postscript file and conver it
to a png using the Gimp.  I'm used to doing that with lattice plots.


Patrick Connolly
Mt Albert
New Zealand 
Ph: +64-9 815 4200 x 7188
I have the world`s largest collection of seashells. I keep it on all
the beaches of the world ... Perhaps you`ve seen it.  ---Steven Wright 

More information about the R-help mailing list