[R] Save generic plot to file (before rendering to device)

Uwe Ligges ligges at statistik.tu-dortmund.de
Sat Jul 16 21:07:53 CEST 2011



On 16.07.2011 20:17, Hadley Wickham wrote:
>>> Thank you, this is very helpful. One final question regarding this method:
>>> suppose a function prints multiple plots, i.e. multiple pages to a PDF. Is
>>> it possible to record all of these plots at once? The code below only
>>> records the final plot. I would like to record all of them, without
>>> modifying myfn:
>>
>> You cannot, since this takes a snapshot from the current device. You will
>> have to recordPlot() after each plot, actually.
>
> It should be possible to do this with a before.plot.new hook, right?
>
> Hadley
>

Yes, sure, if you treat the first and last plot separately. But then, I 
doubt changing "myfn" generates less efforts than inserting the proposed 
hook.

Best,
Uwe



More information about the R-help mailing list