Chris Marshall
2001-May-29 00:46 UTC
[R] any way to set X11() device geometry (screen offsets)?
I am writing an R program to plot data as part of a real time display in a network operations center (NOC). Is there any way, when starting an X11 device in R, to control the location of the plotting window on the screen? I want to put up nine x11 plot windows at different places on the display, and I want the operators to be able to rearrange the window as they see fit by mousing around with the borders. Most of the pieces are already there (like the width and height parameters in the X11 call, and the interactive behavior) except the x and y screen offsets. Chris Marshall -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Thomas Lumley
2001-May-29 02:29 UTC
[R] any way to set X11() device geometry (screen offsets)?
On Mon, 28 May 2001, Chris Marshall wrote:> I am writing an R program to plot data as part of a real time display in a > network > operations center (NOC). Is there any way, when starting an X11 device in > R, to > control the location of the plotting window on the screen? >It doesn't look as though this would be too hard to add. We currently put the lower right corner of the window 10 pixels from the lower right corner of the screen, but it could be made configurable (like the width and height). I can't actually experiment at the moment, since I'm on the wrong operating system. Of course the window manager has the last word on where windows actually go, and some window managers like to think they know better than you. -thomas Thomas Lumley Asst. Professor, Biostatistics tlumley at u.washington.edu University of Washington, Seattle -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Chris Marshall
2001-May-29 11:06 UTC
[R] any way to set X11() device geometry (screen offsets)?
That would be wonderful if you could add it! I am still just plain floored by the usefulness of R and its help list. Chris Marshall -----Original Message----- From: Thomas Lumley To: Chris Marshall Cc: 'r-help at stat.math.ethz.ch' Sent: 5/28/01 10:29 PM Subject: Re: [R] any way to set X11() device geometry (screen offsets)? On Mon, 28 May 2001, Chris Marshall wrote:> I am writing an R program to plot data as part of a real time displayin a> network > operations center (NOC). Is there any way, when starting an X11device in> R, to > control the location of the plotting window on the screen? >It doesn't look as though this would be too hard to add. We currently put the lower right corner of the window 10 pixels from the lower right corner of the screen, but it could be made configurable (like the width and height). I can't actually experiment at the moment, since I'm on the wrong operating system. Of course the window manager has the last word on where windows actually go, and some window managers like to think they know better than you. -thomas Thomas Lumley Asst. Professor, Biostatistics tlumley at u.washington.edu University of Washington, Seattle -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-. -.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._. _._._._ -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Chris Marshall
2001-May-29 13:54 UTC
[R] any way to set X11() device geometry (screen offsets)?
I just knew that had to be a way to do what you describe in X outside of R. What you have described is perfect. Thanks! Chris Marshall -----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)? Thomas Lumley wrote:> It doesn't look as though this would be too hard to add. We currentlyput> the lower right corner of the window 10 pixels from the lower rightcorner> of the screen, but it could be made configurable (like the width and > height). I can't actually experiment at the moment, since I'm on thewrong> operating system. >If you cant wait for the next release of R to do this, then get the really rather useful 'xwit' tool from ftp.x.org or a local mirror. It lets you position and size windows after they've been created, as well as several other things. You need to get the window name of R graphics windows - run xwininfo and click on an R graphics window and you should see something like: xwininfo: Window id: 0x2c00002 "R Graphics: Device 2 (ACTIVE)" and using xwit you can set its geometry exactly with: xwit -move 200 200 -resize 640 200 -names "R Graphics: Device 2 (ACTIVE)" You can then bung this into a function to pop up 9 windows and then call xwit to put them in the right place: x9_function(){ for(i in 1:9){ x11() } for(i in 1:9){ # compute position and size for window i args<-windowsizepos(i) # window name if(i==9){state<-"ACTIVE"}else{state<-"inactive"} name<- paste("\"R Graphics: Device ",i+1," (",state,")\"",sep='') system(paste("./xwit ",args," -names ",name,sep='')) } } You need to write the windowsizepos(i) function to return a string like this:> windowsizepos(1)[1] "-move 20 20 -resize 200 200" that gives the right position and size for the i-th window. It might be worth taking the code that repositions the windows and putting that in a separate function, so you can easily put the windows back in the default place once the user has mucked with them. 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. Hours of fun. Barry Rowlingson Maths and Stats Lancaster University Lancaster, UK -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Chris Marshall
2001-May-29 15:57 UTC
[R] any way to set X11() device geometry (screen offsets)?
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 (screenoffsets)?><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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._