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

Mark Knecht markknecht at gmail.com
Tue Jun 30 21:05:59 CEST 2009


On Tue, Jun 30, 2009 at 11:45 AM, Barry
Rowlingson<b.rowlingson at lancaster.ac.uk> wrote:
> On Tue, Jun 30, 2009 at 6:33 PM, Ted
> Harding<Ted.Harding at manchester.ac.uk> wrote:
>
>> Barry, spot on! If there were a prize for postings with
>> simplicity, clarity, conciseness and usability, I would nominate
>> yours (especially in the "Why didn't *I* think of that?" category).
>
>  Thanks Ted!
>
>  It's just a shame dev.new() doesn't return the device number, since
> that would make things even simpler:
>
> # does not work like this:
>  xyPlot = dev.new()
> histPlot = dev.new()
>
>  Instead it returns whatever the device function (X11,png,postscript
> etc) returns, and they all seem to return NULLs. I suppose in the
> future a device function might return something useful.
>
> Barry
>

You could wrap it in a function of your own making, right?

AddNewDev = function() {dev.new();AddNewDev=dev.cur()}

histPlot=AddNewDev()

Seems to work.

- Mark




More information about the R-help mailing list