R: plot with pdf as background

I would like to build in R using an existing PDF file as a background. The reason I don’t want to use a different format (png, jpg, gif) is because I don’t want to lose image quality in my (existing) pdf file. Any recommendations? Many thanks!

+6
source share
1 answer

Thanks a lot tim riffe! I found the answer in this document:

Convert pdf to ps first. Then do the rest with the grImport package:

#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...) 
+3
source

Source: https://habr.com/ru/post/908326/


All Articles