To make dev.copy work with off-screen devices, you need to call
dev.control("enable").

So you could plot to a temporary file, then take snapshots to another file
like this:
pdf("test1.pdf")
dev.control(displaylist = "enable")
plot(1:10)
dev.copy(pdf, "test2.pdf")
dev.off()
# should now have a valid test2.pdf
dev.off() # finished

But I wonder how Emacs will see the file in the remote case? Maybe you
could somehow have R print the contents of the file, but hide it from the
buffer?



On Mon, Nov 18, 2013 at 3:50 PM, Vitalie Spinu <spinuvit@gmail.com> wrote:

>
> Hi Everybody,
>
> I would like to add "graphics-in-emacs-window" functionality to ESS in
> near future. The most straightforward way to do that is to save graphic
> images to a disc files.
>
> Unfortunately I couldn't figure how to save buffered R devices. With
> screen devices dev.print does the job, but as screen devices are not
> available on remotes, dev.print is out of option. I didn't have luck
> with dev.copy either.
>
> So I would really appreciate if someone can suggest a way to save an
> incomplete R plot into an image file. In other words: How to write a
> function "copyDev" such that the following code
>
>     plot(1:3)
>     copyDev("dev1.png")
>     abline(h = 2)
>     copyDev("dev2.png")
>
> would generate two plots. The current devise is "pdf" or "png" or some
> other non-screen device.
>
> Any other ideas of how to implement the R-graphics-in-emacs functionally
> are very much welcome.
>
> Thanks,
>
>    Vitalie
>
> ______________________________________________
> ESS-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/ess-help
>

	[[alternative HTML version deleted]]

