
col=sample(colors()[-1], ncol(dataframe), replace = FALSE)
 
This may help but since it's randomized it's a crap shoot but the colors are likely to be more distinct.
                  

> Date: Fri, 5 Aug 2011 15:38:57 -0400
> From: sarah.goslee@gmail.com
> To: rloiselle@usgs.gov
> CC: r-help@r-project.org
> Subject: Re: [R] plotting many unique colors with categorical data
> 
> That's far too many to easily distinguish by color, especially if they
> need to be
> distinct, and not levels within a larger class. For the latter, you could get
> by with say 10 shades of red, 10 shades of blue, etc for related factors.
> But it doesn't sound like that's what you have. I don't think there's any
> way to create a palette of 75 distinguishable colors.
> 
> If you really want to try, colors() gives you all the named colors. You
> can also use c() to combine several brewer palettes.
> 
> One thing that I've done in similar cases (for viewing and data snooping,
> not for presentation), is to set up a loop through all the factor levels.
> Set par(ask=TRUE), and for each iteration plot all the points in black,
> except make that level a brighter color, and maybe larger symbol.
> 
> It gives you a quick way to start to see the differences between groups,
> though obviously isn't suitable for publication.
> 
> Sarah
> 
> On Fri, Aug 5, 2011 at 1:46 PM, SavageMaDaMe <rloiselle@usgs.gov> wrote:
> > Hi- I am trying to plot a matrix of categorical values across time using
> > color to represent each individual factor. For example:
> >
> >   1982 1983 1984 1985 1986 1987
> > 1    19   19   68   68   19   19   68
> > 2    68   68   19   19   68   68   19
> > 3    26   26   34   34   26   26   26
> > 4    57   34   57   57   34   57   34
> > 5    34   57   26   26   57   34   57
> > 6    28   28   28   28   28   58   58
> > 7    60   10   58   58   58   28   28
> > 8    58   58   42   27   10   39   39
> > 9    22   39   22   42   42   27   42
> > 10   39   22   10   39   39   20   10
> >
> >
> >  I have 75 factors which could be in different positions through out time
> > (26 years).  I've successfully created a plot using both ggplot() and
> > color2D.matplot(), but can not select enough distinct colors from the
> > default color palettes available to be able to view differences in the data.
> > I've tried messing with RGB values, Brewer palettes, etc.
> >
> > How can I select colors from a list of available colors without choosing
> > ones which are too close in similarity to each other. For instance, I could
> > have several very similar blues, but if the Hue or saturation was different
> > on each, it would be fairly easy to tell the difference?
> >
> > Maybe there are too many factors to make this visual representation
> > effective?
> >
> > Thanks in advance for your help!
> >
> -- 
> Sarah Goslee
> http://www.functionaldiversity.org
> 
> ______________________________________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
 		 	   		  
	[[alternative HTML version deleted]]

