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

Prof Brian Ripley ripley at stats.ox.ac.uk
Fri Feb 20 07:41:01 CET 2009


That still redraws, and it flickers visibly on my (latest model with 
nVidia graphics) MacBook Air (on both quartz() and X11()).

R graphics devices use an 'ink and paper' model, so it is impossible 
to remove (or move) elements.  All you can do is repaint background on 
sections of the plot and redraw there.  It can be done much more 
smoothly than that example in base graphics, at least.

We expect to have a double-buffered X11 device soon (it is delayed by 
event-loop issues) and that will probably not flicker so visibly (the 
windows() device is double-buffered and does not).

On Fri, 20 Feb 2009, Ken Knoblauch wrote:

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