Here is a recent posting by Petr Klasterecky that does not seem to be on the archive yet that may help. ----------------------------------------------
What do you mean by background? Maybe this is enough: plot(seq(-3,3,.01), dnorm(seq(-3,3,.01)), type="n", xlab="x", ylab="f(x)", main="Normal density") polygon(x=c(-4,0,0,-4), y=c(-1,-1,.5,.5), col="red") polygon(x=c(4,0,0,4), y=c(-1,-1,.5,.5), col="blue") lines(seq(-3,3,.01), dnorm(seq(-3,3,.01)), type="l", lwd=2) Play a little bit with the polygon margins to get what you need. You can even generate them automatically based on your data. Petr ----------------------------------------------- --- A Ezhil <[EMAIL PROTECTED]> wrote: > Dear All, > > I am using the following commands to do the scatter > plot of two vectors, say X and Y. > > plot(X,Y, col="blue") > abline(a=1,b=1, col="red") > abline(a=-1,b=1, col="green") > > I would like to split the scatter plot into 3 part > with 3 different colors: (i) points lies between 2 > lines, (ii) points above line 1, and (iii) points > below line 2. I am struggling to do this. I would > greatly appreciate any help in doing this. > > Thanks in advance. > > Kind regards, > Ezhil > > ______________________________________________ > [email protected] mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, > reproducible code. > ______________________________________________ [email protected] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
