[R] repeating colors in graph

Thomas Lumley tlumley at u.washington.edu
Thu Oct 23 18:38:27 CEST 2003


On Thu, 23 Oct 2003, Barry Rowlingson wrote:

> Thomas Lumley wrote:
>
> > See the help pages for color() and palette(), and perhaps the RColorBrewer
> > package.
>
> Splus lets you define colour palettes in its Gui, using a nice little
> notation where you specify something like "black 8 white 6 red" to get a
> 17-colour palette with 8 colours between balck and white and then 6
> colours up to red (linearly interpolating RGB values). Here's a little R
> function to do something similar:
>
<snip>
>
>   Of course, linearly interpolating in RGB might not be the right thing
> to do...
>

It isn't, but it works fairly well with well chosen colors (for example,
linearly interpolating the RColorBrewer sequential or diverging schemes
gives quite nice color ramps).  It's unlikely to work for producing
palettes for 13 different lines.


	-thomas




More information about the R-help mailing list