[R] repeating symbols and colors

Jim Lemon jim at bitwrit.com.au
Thu Nov 2 11:01:15 CET 2006


Charles Annis, P.E. wrote:
> Here’s an easy one.  Well, easy for those more clever than I am.
> 
> I am plotting several groups and use symbols 15:25, pch <- 15:25
> 
> Sometimes, however, I need more than those and would like to have them
> recycled automatically so that pch[12] = pch[1].  Perhaps I can use %% or
> kludge up a multi-line, multi-if solution, but hope that a kind helper can
> suggest something more elegant.
> 
maybe rep(...,length.out=...) ?

> I am also using RColorBrewer and like "Set1" but that has only 9 colors.  I
> don't want infinitesimal color gradations and would prefer to re-use those
> colors if I can find a way to recycle them too.  Since the number of
> available colors and available symbols differ, the color/symbol combinations
> will be unique for the recycled usage.
> 
color.gradient in the plotrix package allows the user to build a set of 
colors with a specified number of elements, from simply interpolating 
between two endpoints to specifying every RGB component.

Jim



More information about the R-help mailing list