[R] How to add background color of a 2D chart by quadrant

Mike Prager mike.prager at noaa.gov
Wed Apr 9 15:39:03 CEST 2008

"tom soyer" <tom.soyer at gmail.com> wrote:

> I have a 2D chart that is divided into four quadrants, I, II, III, IV:
> plot(1:10,ylim=c(0,10),xlim=c(0,10),type="n")
> abline(v=5,h=5)
> text(x=c(7.5,7.5,2.5,2.5),y=c(2.5,7.5,7.5,2.5),labels=c("I","II","III","IV"))
> I would like to fill each quadrant with a background color unique to the
> quadrant. Does anyone know how to do this in R?

In response to a similar question no more than two weeks ago, I
posted detailed code as an example.  I expect it would be easy
to modify my example to fit your question.  

If you search the group archives, you should be able to find it.
The thread title was "background color in scatterplots".


Mike Prager, NOAA, Beaufort, NC
* Opinions expressed are personal and not represented otherwise.
* Any use of tradenames does not constitute a NOAA endorsement.

More information about the R-help mailing list