[R] pdf with an exact size

Alberto Monteiro albmont at centroin.com.br
Fri Feb 23 19:52:45 CET 2007


I must be stupid and/or crazy... I figured out the solution a few
minutes after I asked :-/

> Is it possible to create a pdf output file with an (as nearly as
> possible) exact size?

Yes:

  pdf("a4.pdf", width=210, height=297, bg="white", paper="a4")
  par(mar=c(0,0,0,0)) # reset margins
  plot(0, xlim=c(0, 210), ylim=c(0, 297), col="white")
  par(usr=c(0, 210, 0, 297))
  points(c(100, 100, 200, 200, 100), c(100, 200, 200, 100, 100, 100),
    type="l", col="black")
  dev.off()
 
Alberto Monteiro



More information about the R-help mailing list