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