[Rd] cascade option for dev.new?

Prof Brian Ripley ripley at stats.ox.ac.uk
Fri Nov 6 09:26:36 CET 2009

On Wed, 4 Nov 2009, John Nolan wrote:

> I frequently run scripts that generate multiple graphs.  Unless you 
> specify a specific window location, dev.new superimposes all new 
> graphics windows exactly on top of each other.  It would be nice to 
> have a "cascade=TRUE" option in dev.new to prevent windows from 
> being hidden.  A hasty approximation to this is the following 
> function:

dev.new just passes arguments on to the device selected.  *If* such 
an argument were appropriate, it would need to added to the screen 
devices, only some of which even have *pos arguments.

On the relatively few occasions I want multiple screeen devices open, 
I want to control their size and location in ways different from the 
defaults so would call X11() or quartz() directly.

If you find your suggestion has widespread support (and I've seen none 
so far), you are welcome to implement it on all relevant devices (and 
we don't even know your OS -- see the posting guide) and submit 
patches for consideration.

> # utility function to prevent overlapping plot windows
> cascade <- function( k=dev.cur(),x0=300,y0=50,dx=30,dy=30){
>  dev.new( xpos=x0+k*dx, ypos=y0+k*dy);
>  invisible() }
> x <- seq(-10,10,.1); y <- sin(x)
> plot(x,y,type='l',main='first plot')
> cascade()
> plot(x,y,type='l',main='second plot')
> John Nolan
> Math/Stat Dept.
> American University
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel

Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

More information about the R-devel mailing list