[R] plotting and unplotting lines in R

About this list Date view Thread view Subject view Author view Attachment view

From: Alejandro Munoz del Rio (munoz@stat.wisc.edu)
Date: Tue 14 Jan 2003 - 04:05:54 EST


Message-id: <01c501c2bb26$0940fac0$2d2b5c90@surgery.wisc.edu>


"RexBryan" <rexbryan1@attbi.com> writes:
> I would like to plot and unplot a line to a graph using R's line
> command. This would allow for sequentially trying different plotted
> functions for a visual fit. Is there a way to do this?

you can try re-plotting the line you want to erase in the color that matches
the bacground, e.g.
x <- rnorm(100)
plot(x)
lines(1:100, cos(1:100))
# assess quality of fit, then erase:
lines(1:100, cos(1:100), col="white")
# draw next fit
lines(1:100, sin(1:100))

the solution isn't "clean" in that erasing the line may also erase some of
the points. to prevent this, use
points(x), or re-plot altogether via plot(x)

hope this helps,

alejandro

______________________________________________
R-help@stat.math.ethz.ch mailing list
http://www.stat.math.ethz.ch/mailman/listinfo/r-help


About this list Date view Thread view Subject view Author view Attachment view

This archive was generated by hypermail 2.1.3 : Tue 01 Jul 2003 - 09:11:19 EST