[R] How do I change which R Graphics Device is active?

Mark Knecht markknecht at gmail.com
Tue Jun 30 19:51:03 CEST 2009


On Tue, Jun 30, 2009 at 9:48 AM, Barry
Rowlingson<b.rowlingson at lancaster.ac.uk> wrote:
> On Tue, Jun 30, 2009 at 5:15 PM, milton ruser<milton.ruser at gmail.com> wrote:
>> How about:
>>
>> dev.cur()
>> dev.list()
>> dev.next(which = dev.cur())
>> dev.prev(which = dev.cur())
>> dev.off(which = dev.cur())
>> dev.set(which = dev.next())
>> dev.new(...)
>> graphics.off()
>> dev.cur()
>> dev.list()
>> dev.next(which = dev.cur())
>> dev.prev(which = dev.cur())
>> dev.off(which = dev.cur())
>> dev.set(which = dev.next())
>> dev.new(...)
>> graphics.off()
>> :-) bests
>>
>
>  To keep track, call dev.cur() after creating a new plot and assign it
> to something memorable. Here's how to keep a histogram and an xy plot:
>
>> dev.new();histPlot = dev.cur()
>> dev.new();xyPlot = dev.cur()
>> dev.set(histPlot);hist(runif(100))
> X11cairo
>       2
>> dev.set(xyPlot);plot(1:10)
> X11cairo
>       3
>
>  You just have to remember to call dev.set before your particular plot.
>
>
> Barry
>

Makes great sense and fits in very nicely with what I'm doing.

Thanks!

- Mark




More information about the R-help mailing list