[R-SIG-Mac] update graphics component without redrawing whole plot

iuhz7j202 at sneakemail.com iuhz7j202 at sneakemail.com
Fri Feb 20 16:02:42 CET 2009

Regarding adding Sys.sleep() call: it does make things smoother, but it also defeats the purpose of having live-updating graphics. (Adding a 0.1-second delay to each of the 10^6 simulation timesteps would be counterproductive). I could effectively do something like this by only updating the graphics every few hundred timesteps (I've done this in the past), and that may end up being the best solution.

Prof. Ripley:
That's what I thought. However there are some approaches, eg rgl and rggobi, that don't seem to have the pen-and-paper limitation. I've been playing with rgl, and you can remove individual elements from the shape stack -- you can't edit elements, but you can remove and replace them for somewhat smooth updating.
Ideally there would be something like rggobi that is less special-purpose. With rggobi you can edit the data that generated the plot directly in R and it is immediately and smoothly updated in the window. Unfortunately I've been struggling to use rggobi for R-based network plotting.

Unless I can figure out something cleaner, I'll probaby use the rgl option. It's not ideal (particularly since I don't need 3d), but seems to be the easiest and most flexible way around the "pen and paper" issue. Example code:
  xx <- points3d(0,0,size=20)
  for(i in 1:100/10){
    xx <- points3d(i,0,0,size=20)

Thanks very much for all the feedback so far.


More information about the R-SIG-Mac mailing list