Hello, If I execute X11() plot( stuff ) X11() plot( other stuff) then at this point I have two windows with plots and the second graphics window is active. I don't see the devices using ls(). 1) Without destroying the second window how do I make the first window active again? 2) How do I destroy a specific window when I'm done with it? 3) Is there some generic way to understand what windows are out there at any given time or do I need to create some sort of list and keep track of it myself? In general I'd like to have 4 or 5 windows and be able to switch and update individual plots as the needs arise. Is there a way to name these devices/windows? I don't see any examples of this sort of thing in the help file. Maybe there's a different add-on package I don't yet know about? Thanks, Mark
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 milton On Tue, Jun 30, 2009 at 12:07 PM, Mark Knecht <markknecht@gmail.com> wrote:> Hello, > If I execute > > X11() > plot( stuff ) > X11() > plot( other stuff) > > then at this point I have two windows with plots and the second > graphics window is active. I don't see the devices using ls(). > > 1) Without destroying the second window how do I make the first window > active again? > 2) How do I destroy a specific window when I'm done with it? > 3) Is there some generic way to understand what windows are out there > at any given time or do I need to create some sort of list and keep > track of it myself? > > In general I'd like to have 4 or 5 windows and be able to switch and > update individual plots as the needs arise. Is there a way to name > these devices/windows? I don't see any examples of this sort of thing > in the help file. Maybe there's a different add-on package I don't yet > know about? > > Thanks, > Mark > > ______________________________________________ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html<http://www.r-project.org/posting-guide.html> > and provide commented, minimal, self-contained, reproducible code. >[[alternative HTML version deleted]]
Barry Rowlingson
2009-Jul-01 14:45 UTC
[R] How do I change which R Graphics Device is active?
On Wed, Jul 1, 2009 at 3:30 PM, Don MacQueen<macq at llnl.gov> wrote:> My version would be > > ?newDev <- ?function() { dev.new(); invisible( dev.cur() ) } > > I agree with Hadley that return() is redundant in this instance. Using > invisible() suppresses automatic printing of the returned value when it is > not being assigned to a variable, thus making it more like dev.new().Hmmm. I really like using explicit return calls in my functions. It seems, to me, to make it clear that I intend to return a value and that value is going to be useful. How can others tell (without looking at the ample documentation, of course) that you intend your function to have a meaningful return value and it's not just "falling through"? As The Zen of Python puts it: Explicit is better than implicit. Readability counts. but you know, hey, whatever you want to do :) Barry