将图写入文件时如何使用locator()
?
pdf(file = 'foo.pdf')
plot(i)
x <- locator()
text(x)
dev.off()
text.default(x) 中的错误:指定了零长度的"标签"
调用 png()
、bmp()
等会产生相同的错误。
对于后代:
recordPlot()
的功能相当好:
plot(i)
x <- locator(1)
text(x)
p1 <- recordPlot()
png(file = 'foo.pdf')
p1
dev.off()