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

iuhz7j202 at sneakemail.com iuhz7j202 at sneakemail.com
Thu Feb 19 23:37:55 CET 2009


Hi,

I know that interactive graphics aren't R's strongpoint, but I have a question for this list:

Are there any devices/packages available for R on Mac OS that let you move a single element in a plot without redrawing the whole plot? 

I have a complex simulation running in R (with networks and cumulative summary stats), and I want to be able to make small updates to the graphics as the simulation runs. Each tick only a very few of the many graphics elements need to be changed. With standard R plotting this slows the simulation down excessively and 'flickers' the whole graphics window throughout. 

The grid package lets you shift individual elements, but I've tried it in X11(), quartz() and Cairo() devices and in every case it still redraws whole plot. quartz() seems to be the fastest, but also the most flickery.

As a quick example of what I'm talking about, here is some code:

  library(ggplot2)
  qplot(1:5,1:5)
  for(i in 1:30){
    grid.gedit(gPath("geom_point"),x=unit((1:5/5)/i,"npc"))
  }

This should shift the five points in the plot smoothly to the left, but the redrawing of the whole background etc makes it difficult to see what's going on.

Any ideas would be greatly appreciated.

Many thanks,

Peter



More information about the R-SIG-Mac mailing list