[R] Plot symbols for more than 25 groups

Gabor Grothendieck ggrothendieck at myway.com
Fri Apr 2 17:03:48 CEST 2004

Marc R. Feldesman <feldesmanm <at> pdx.edu> writes:

> Is there any effective way to get distinct geometric plotting symbols and 
> colors for plots involving more than 25 groups?

Not sure if geometric shapes is essential but if not you could plot them 
with different letters (or LETTERS).  The following plots one point for 
each state of 26 states using a, b, ...,z :

df <- data.frame(state.x77)[1:26,]
plot(Life.Exp ~ Income, data=df, pch=letters)

# Alternately you could plot them all with points but label each point
# with a different letter:

plot(Life.Exp ~ Income, data=df, pch=20)
text( df$Income, df$Life.Exp, LETTERS, pos=3)

# or even use the state abbreviations in this case:

plot(Life.Exp ~ Income, data=df, pch=20)

More information about the R-help mailing list