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

Prof Brian Ripley ripley at stats.ox.ac.uk
Fri Feb 20 16:12:51 CET 2009

On Fri, 20 Feb 2009, iuhz7j202 at sneakemail.com wrote:

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

You asked about graphics devices, and those do not use R graphics 
devices: maybe you did not mean the technical term?  OpenGL is a much 
richer model, and many modern widget sets are also richer.

Another approach that may not play well on Macs is to use Tk: the 
tkrplot demo shows you can more points around a Tk canvas smoothly.

> 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:

>  library(rgl)
>  points3d(rnorm(10),rnorm(10),size=10)
>  xx <- points3d(0,0,size=20)
>  for(i in 1:100/10){
>    pop3d(id=xx)
>    xx <- points3d(i,0,0,size=20)
>  }
> Thanks very much for all the feedback so far.
> Peter
> _______________________________________________
> R-SIG-Mac mailing list
> R-SIG-Mac at stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/r-sig-mac

Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

More information about the R-SIG-Mac mailing list