[R] repeating colors in graph

Thomas Lumley tlumley at u.washington.edu
Thu Oct 23 16:48:24 CEST 2003


On Thu, 23 Oct 2003, Anna Pryor wrote:

> I have a plot with 13 lines and R repeats colors.  Is there any way to make R
> not repeat colors, or is this just a fundamental limitation on R's part to
> say have only 8 colors that it can use?

You can change the color palette with the palette() function, supplying as
long a vector of colors as you want.

Alternatively, you can specify colors explicitly rather than as numbers
(either by name or by rgb values)

You may have difficulty coming up with 13 colors that are clearly
distinguishable when applied to narrow lines.

See the help pages for color() and palette(), and perhaps the RColorBrewer
package.


	-thomas




More information about the R-help mailing list