Jochen,
On Apr 30, 2012, at 8:40 AM, jochen laubrock wrote:
> 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?
Yes, you may want to read up on "anti-aliasing". You can disable anti-aliasing
(with antialias=F) but you get very ugly plots.
> 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?
>
You presume wrongly - it is in fact less efficient to try to erase a plot by
painting over it and re-drawing a new one as opposed to drawing a new page,
because you keep piling up the display list which forces R to redraw everything
including over-painted parts of the plot.
If you want to do animation I hope you are aware of the crucial commands
dev.hold()/dev.flush() designed for that purpose (and efficiency).
Cheers,
Simon
> 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"))
> _______________________________________________
> R-SIG-Mac mailing list
> [email protected]
> https://stat.ethz.ch/mailman/listinfo/r-sig-mac
>
>
_______________________________________________
R-SIG-Mac mailing list
[email protected]
https://stat.ethz.ch/mailman/listinfo/r-sig-mac