[R] Getting unique colours

Milan Bouchet-Valat nalimilan at club.fr
Thu Nov 17 10:59:14 CET 2011


Le mercredi 16 novembre 2011 à 20:02 -0800, Quercus a écrit :
> Hey everyone, 
> 
> I am new to R, and I'm making a scatter plot graph where i have a bunch of
> plots/points that fall into 9 unique categories. I want each category to
> have a unique colour, however, with the coding I have (below), the colour
> black is repeated for two of my plot types. Does anyone know a quick way to
> get 9 unique colours??
> 
> Coding:
> plotba = plot (predictedba ~ actualba, col=as.numeric(ecosite), pch=19,
> cex=1.5, ylab="Predicted Basal Area (m2/ha-1)", xlab="Actual Basal Area
> (m2/ha-1)")
> 
> Thanks!
You can use col=rainbow(9). For more choice about the color palette,
also see the RColorBrewer package.


> Here's what it looks like currently:
> 
> http://r.789695.n4.nabble.com/file/n4078889/predicted_height.jpeg 
Sorry, the link doesn't work.

Regards



More information about the R-help mailing list