【发布时间】:2013-10-10 16:46:50
【问题描述】:
我需要在 PDF 设备上的页面极端边框上书写。有了这个 sn-p:
pdf('foo.pdf') #Write next plot to foo.pdf in current dire
par(mar=c(0, 0, 0, 0)) #Set numbers of lateral blank lines to zero
par(xaxs='i', yaxs='i') #Does not extend axes by 4 percent for pretty labels
plot.new() #Create a blank plot, as we just want to write our text
text(0, .5, "hello", pos=4, offset=0) #Write to the right with no default 0.5 offset
dev.off() #Close device, that is saving for a PDF device
我得到一个foo.pdf 和hello 在页面中间的最左边,正如预期的那样:
不幸的是,如果我将纸张输出设置为paper='a4',那就是:
pdf('foo.pdf', paper='a4') #note the A4 setting
par(mar=c(0, 0, 0, 0))
par(xaxs='i', yaxs='i' )
plot.new()
text(0, .5, "hello", pos=4, offset=0)
dev.off()
hello 不再放在边框上,但是:
【问题讨论】:
标签: r pdf-generation