Funny how there does not seem to be a dummy device that just records the
display list. You either need to have a screen device or plot to a
temporary file. The gridSVG package will let you capture textual SVG, I
think without touching a file. But that's only for grid, and then you have
the problem of rendering the SVG ;) Deepayan's Qt device can capture any
kind of graphics in any format, but that requires Qt. Too bad the file
devices do not support connections... would make capturing png easy.



On Mon, Nov 18, 2013 at 4:07 PM, Michael Lawrence <michafla@gene.com> wrote:

> 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]]

