tags:

views:

62

answers:

1

Question: how can you create a pdf where the output is vertically justified, with for example, a one inch margin on top using pdf().

For example in

pdf(file='test.pdf', paper='letter', pagecentre=F)
### code for plot here ###
dev.off()

is there an option where it generate output that starts from the top of the page rather than printing from the bottom of the page (which is what happens when pagecentre=F). Or will this require some adjustment of settings in par()?

+1  A: 

I always use

pdf(file="/tmp/foo.pdf", width=10.5, height=8)
plot(....)
dev.off()

which nicely fills the page with just 1/2 inch spacing. You can flip width and height arguments to go to 'portrait' rather than 'landscape'.

Dirk Eddelbuettel
Thanks. However, suppose you're interested in just filling the top half of the page with the figure that's 4 x 4"? I wish there was a vertical justify option, besides just the pagecentre parameter.
andrewj
Use par(mfrow=c(2,2)) and put an empty plot below --- but R is *not* a typesetting system. Use e.g. Sweave for that.
Dirk Eddelbuettel