R:以pdf为背景的情节

Abd*_*del 6 pdf plot r

我想使用现有的pdf文件作为背景在R中绘图.我不想使用其他格式(png,jpg,gif)的原因是我不想在我的(已经存在的)pdf文件中丢失任何图像质量.有什么建议?非常感谢!

Abd*_*del 3

非常感谢蒂姆·里夫!我在那篇文档中找到了答案:

首先将pdf转换为ps。然后使用 grImport 包完成剩下的工作:

#convert the ps to xml:
PostScriptTrace("image.ps")

# store the xml info in RGML format (R Graphics Markup Language):
NLmap <- readPicture("image.ps.xml")

#plot the image
plot(etc...)
par(new=T)
plot(grid.picture(NLmap[-1]),etc...)
Run Code Online (Sandbox Code Playgroud)