我需要在页面极端边框的 PDF 设备上书写。有了这个片段:
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
with 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
不再放在边界上,但是: