[R] using R to generate resizable real-time plots

Chris Marshall chrism at norcomnetworks.com
Mon Aug 20 19:40:49 CEST 2001


I am trying to use R to repeatedly plot data to an X11 device from a file
that is being updated every five minutes.  My initial strategy was to use a
loop in R that roughly looks like this

while (TRUE){
   system("sleep 10")
   plot(x,y)
}

However, this had an interesting side effect: when I try to resize the plot
window under X, R never processes the resize events like it would if I had
invoked R interactively and typed a command into the xterm I was running R
from.

I would like to get around this somehow so that R does not go to sleep like
this and stop processing X events.

My next attempt went like this.  I wrapped the R script in a bash script and
had the bash script go to sleep:

#!/bin/bash

( 
   while true; do
      sleep 10
      echo "plot(x,y)"
   done
) | R --no-save

This fared no better.  I then tried the same thing with a named pipe with no
more success.

Any ideas?

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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list