[R-SIG-Mac] clearing plot / over plotting of points

jochen laubrock jochen.laubrock at gmail.com
Mon Apr 30 14:40:45 CEST 2012


Hello,

points are not completely erased if overplotted in the background color, using points from base graphics. Instead, they leave a faint grey trace, both if running R.app and R in Terminal. Is this intended? What is the proper way to erase a plot if one does not want to create a new plot, which presumably has some overhead in an animation?

Example,  using points:

A <- matrix(rnorm(1000), 500, 2)
plot(range(A), range(A), type="n")
points(A)
points(A[1:250, 1:2], col="white", bg="white")

I'm posting to this list because I have not tested under a different OS.

Jochen

> sessionInfo()
R version 2.15.0 (2012-03-30)
Platform: x86_64-apple-darwin9.8.0/x86_64 (64-bit)

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] lattice_0.20-6 MASS_7.3-17   

loaded via a namespace (and not attached):
[1] grid_2.15.0  tools_2.15.0



PS: Points *are* erased if using image

# using image
A <- matrix(0, 100, 100)
ix <- runif(1000, 0, 10000)
A[ix] <- 1
image(seq(0,1,length=100), seq(0,1,length=100), A, col=c("white", "black"))
A[ix[1:500]] <- 0
image(seq(0,1,length=100), seq(0,1,length=100), A, col=c("white", "black"))


More information about the R-SIG-Mac mailing list