Try using polygon() or grid.polygon() from the grid package. You can find code example on the R project title page. Go to http://r-project.org and click on the plot (the example plot showing PCA, clustering and factors, lower left are two graphs, similar to what you want).
This will bring you to the source code, generating this plot. Search for "Factor 1" on the page will show that this plot was produced with the function plotdens(). Search for "plotdens" will show its body and will discover, that it calls polygon() function. -- View this message in context: http://r.789695.n4.nabble.com/how-to-do-a-graph-with-tree-different-colors-tp4635206p4635268.html Sent from the R help mailing list archive at Nabble.com. ______________________________________________ R-help@r-project.org 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.