[S] switching graphics devices

Don MacQueen (macqueen1@llnl.gov)
Fri, 22 May 1998 12:55:38 -0800


Since I'm in a presumptous mood...daring to presume that others will find
some of my functions useful, here is simple little one. The idea is to have
two graphics devices open, and easily switch back and forth between them.

dev.switch <- function(dc = dev.cur(), dl = dev.list())
{
ids <- rev(rev(dl)[1:2])
new <- ids != dc
dev.set(ids[new])
}

Usage:
> dev.switch()

It works with more than two graphics devices, provided that dev.cur() is
one of the last two devices in dev.list(), in which case it switches back
and forth between the last two listed by dev.list().

Much the same thing can be done by things like dev.set(dev.prev()) and
dev.set(dev.next()), but dev.switch() is easier for me to remember and use.

-Don

--------------------------------
Don MacQueen
Environmental Protection Dept.
Lawrence Livermore National Lab
macq@llnl.gov (925) 423-1062
--------------------------------

-----------------------------------------------------------------------
This message was distributed by s-news@wubios.wustl.edu. To unsubscribe
send e-mail to s-news-request@wubios.wustl.edu with the BODY of the
message: unsubscribe s-news