[R] Attaching interactive plot to existing PDF file

Jonas Malmros
Sun, 28 Oct 2007 18:57:39 -0000

Dear list members,

I create a pdf file with a number of barplots and histograms:
pdf(file=my.pdf.file, paper="a4", width=6, height=10)
...
dev.off()

Then I run a model and plot fitted vs residuals and interactively
(using identify()) label some of the residuals on that plot.
After that I want to append this interactive plot to the already
existing PDF file.

How can I do that?

I tried opening new device with x11()
then plotting fitted vs residuals in it and then (since pdf device is
still open)
dev.copy(dev.cur(), which=dev.prev())
but this produces error message :
Error in dev.copy(dev.cur(), which = dev.prev()) :
  cannot supply 'which' and 'device' at the same time

and when I close off the devices, my PDF file contains only barplots
and histograms.

Could someone please instruct me?
Thank you in advance for your time and help.

--
Jonas Malmros
Stockholm University
Stockholm, Sweden