[R] Crop white border for PDF output

Stephen Eglen S.J.Eglen at damtp.cam.ac.uk
Thu Nov 24 12:15:40 CET 2005


Claus Atzenbeck writes:
 > On Tue, 22 Nov 2005, Marc Schwartz wrote:

 > The disadvantage with pdfcrop is that it takes an additional step:
 > First, I have to produce the diagrams, then, I have to call pdfcrop on
 > them to crop the white space. pdfcrop does a perfect job here: It crops
 > the complete white space around a diagram automatically without having
 > me to name some concrete numbers. It would be very nice if R would have
 > an option that would allow to do me to do this for graphics that will be
 > included in documents later.

Does pdfcrop take input from stdin?  I normally have a similar problem
when making postscript files.  Rather than worry about the excess size
of the border, I do the following:

  postscript(file="|psfbb> w81s1_m623.ps",
             width=7, height=4, onefile=FALSE, horiz=F)
  plot ...
  dev.off()

Where my script, psfbb, crops to a tight bounding box.  Maybe
you could try 

  pdf(file='|pdfcrop > yourfile.pdf')
  ...
  dev.off()


My script, psfbb, is available from:
  http://www.damtp.cam.ac.uk/user/sje30/postscript/psfbb

Stephen




More information about the R-help mailing list