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

Ken Knoblauch ken.knoblauch at inserm.fr
Fri Feb 20 07:11:18 CET 2009


 <iuhz7j202 <at> sneakemail.com> writes:

> 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? 
....
> 
> 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
Now about something like

 library(ggplot2)
  qplot(1:5,1:5)
  for(i in 1:30){
    grid.gedit(gPath("geom_point"),x=unit((1:5/5)/i,"npc"))
    Sys.sleep(0.1)
  }
> 
> Many thanks,
> 
> Peter
> 

-- 
Ken Knoblauch
Inserm U846
Stem-cell and Brain Research Institute
Department of Integrative Neurosciences
18 avenue du Doyen Lépine
69500 Bron
France
tel: +33 (0)4 72 91 34 77
fax: +33 (0)4 72 91 34 61
portable: +33 (0)6 84 10 64 10
http://www.sbri.fr/members/kenneth-knoblauch.html



More information about the R-SIG-Mac mailing list