[R] any way to set X11() device geometry (screen offsets)?
Chris Marshall
chrism at norcomnetworks.com
Tue May 29 17:57:00 CEST 2001
Thomas:
I have already messed around with this for a few hours. I have listed the
functions I wrote below.
The actual usage would look like this:
ids <- get.win.ids()
resize.plot.win(ids[1],600,200)
That xwit sure is useful!
Chris Marshall
get.win.ids <- function(){
dl <- as.vector(dev.list())
cur <- as.vector(dev.cur())
ids <- c("")
for (i in 1:length(dl)){
if (cur==dl[i]){
name <- paste("R Graphics: Device ",cur," (ACTIVE)",sep="")
}
else {
name <- paste("R Graphics: Device ",dl[i]," (inactive)",sep="")
}
x <- strsplit(
system(paste("xwininfo -name \"",name,"\" | grep \"Window
id:\"",sep=""),intern=TRUE),
split=" "
)
ids[i] <- x[[1]][4]
}
ids
}
resize.plot.win <- function(id,w,h){
system(paste("xwit -id ",id," -resize ",w," ",h,sep=""))
}
move.plot.win <- function(id,x,y){
system(paste("xwit -id ",id," -move ",x," ",y,sep=""))
}
Chris Marshall
-----Original Message-----
From: Thomas Lumley
To: Chris Marshall
Cc: ''r-help at stat.math.ethz.ch' '
Sent: 5/29/01 11:33 AM
Subject: RE: [R] any way to set X11() device geometry (screen offsets)?
> -----Original Message-----
> From: B.Rowlingson at lancaster.ac.uk
> To: Thomas Lumley
> Cc: Chris Marshall; 'r-help at stat.math.ethz.ch'
> Sent: 5/29/01 8:19 AM
> Subject: Re: [R] any way to set X11() device geometry (screen
offsets)?
>
<snip>
> You might also be able
> to
> use the dev. functions to figure out which is the active window so you
> can
> insert 'ACTIVE' or 'inactive' in the window name.
dev.list() gives the list of current device numbers and dev.cur() gives
which one is "ACTIVE"
eg
R> l<-dev.list()
R> act<-paste(l,"(inactive)")
R> act[match(dev.cur(),l)]<-paste(dev.cur(),"(ACTIVE)")
R> paste("R Graphics Device:",act)
[1] "R Graphics Device: 2 (inactive)" "R Graphics Device: 3 (ACTIVE)"
-thomas
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
More information about the R-help
mailing list