Martin Batholdy
2013-May-17 14:04 UTC
[R] update an array of plots in 'real-time' without drawing lags
Hi, I know R is not made for this, but I still wanted to ask if there are possibilities to do this; I repeatedly collect data from a database for a given time interval. Now I would like to monitor the change of this data with some nice plots. I actually have to draw 15 plots to get the whole picture. Now I can write a loop that, for a given time interval, updates the data and plots them using one quartz window that is split into subparts with the layout function. However, since I redraw every plot every time, the drawing takes some time and it is not an "instant update" that I see. The plots are slowly redrawn from the upper left corner of the quartz window to the bottom right. That makes me wonder; Is there a way to buffer the graphical device before updating it? Or are there any other solutions for R that enables to smoothly plot / visualize data in 'real-time'? I am grateful for any suggestions!
David Winsemius
2013-May-17 17:49 UTC
[R] update an array of plots in 'real-time' without drawing lags
On May 17, 2013, at 7:04 AM, Martin Batholdy wrote:> Hi, > > I know R is not made for this, but I still wanted to ask if there are possibilities to do this; > > > I repeatedly collect data from a database for a given time interval. > Now I would like to monitor the change of this data with some nice plots. > > I actually have to draw 15 plots to get the whole picture. > Now I can write a loop that, for a given time interval, updates the data and plots them using one quartz window that is split into subparts with the layout function. > > However, since I redraw every plot every time, the drawing takes some time and it is not an "instant update" that I see.It is not clear whether this is an asynchronous process that uses new data to draw some of the plots but not others.> The plots are slowly redrawn from the upper left corner of the quartz window to the bottom right. > > > That makes me wonder; > Is there a way to buffer the graphical device before updating it? > Or are there any other solutions for R that enables to smoothly plot / visualize data in 'real-time'?You can split 'screens' on a graphics device to which you can send plotting output. You already know that you can construct 'layout's. You can have multiple interactive output devices. The split-screen method is incompatible with layout. ?Devices ?dev.cur ?screen -- David Winsemius Alameda, CA, USA