[R] pdf device bounding box?

Michael Toews mwtoews at sfu.ca
Fri Mar 9 09:26:27 CET 2007


I apologize if I don't fully understand your question, but the pdf 
device has a "MediaBox", which is equivalent to the "BoundingBox" in EPS 
file. The PDFs from R are defined nicely using height/width dimensions, 
and work well with embedding in pdflatex, etc. For example:

pdf("test.pdf",height=3,width=3)
plot(1:10)

and view the (partially binary) output in your shell:
less -N test.pdf

on line 117 of this file, I see "/MediaBox [0 0 216 216]" which is a 3in 
by 3in box measured in PostScript points.

I don't understand how you are mixing this in with the epstopdf command. 
If you want to make both a PDF and EPS, my best advice is to do both 
directly from R (see ?postscript for EPS file generation .. the same 
example as above will have "%%BoundingBox: 0 0 216 216" on line 10), and 
your output  for both formats should be clean, simple, and good enough 
for publishers and everyone else to use.

Just one caution, if you have a Windows computer and R < 2.5.1 (which is 
most of us), make sure you write EPS files before loading up a PDF 
device (PR#9517).



More information about the R-help mailing list