double.buffer(action)
NULL
is returned invisibly.
If
action
is
"back"
then all future graphics will be drawn to
an invisible graphics buffer and the current graphics on the screen
will remain unchanged.
If
action
is
"copy"
then that invisible
buffer is copied to the graphics window, replacing the graphics that
might be on the window.
If
action
is
"front"
then all future graphics
will be drawn on the graphics window.
When using double buffering, you should make sure that you call
double.buffer("front")
at the end so that future graphics get drawn on the visible graphics window.
This function currently only works with the
motif()
graphics device.
It is experimental and may be changed or withdrawn in the future.
While drawing on the invisible back buffer the visible window is
not properly refreshed when it is uncovered. There also may be some
problems when resizing the window, but they should be fixed by
the time you call
double.buffer("copy")
or
double.buffer("front")
.
# Display the tail of a simulated time series as it evolves test.double.buffer <- function(n = 100, m = 50) { on.exit(double.buffer("front")) x <- runif(100) plot(x, type = "l") for(i in 1:n) { double.buffer("back") x[1:99] <- x[2:100] x[100] <- mean(x[(100 - m + 1):100]) + runif(1)/3 plot(x, type="l", main=paste("Iteration", i)) double.buffer("copy") } } motif() test.double.buffer()