[R] Selecting / creating unique colours for behavioural / transitional data

Jim Lemon jim at bitwrit.com.au
Sat Mar 14 11:07:33 CET 2009


Ross Culloch wrote:
> Hi Kingsford,
>
> Thanks yet again for your help! I have tried this, and once again i have
> failed! I have put the code that i've used below (i'm sure you'll note some
> bad practice) if that is any use to help explain where i'm going wrong, it
> seems to run fine and feeds back just what you noted it would, but i still
> get the error message as before - if you have any more suggestions i'd be
> very greatful, i'm sure it is down to me missing something very simple!
>   
Hi Ross,
See if this will do what you want:

library(plotrix)
color2D.matplot(matrix(0,nrow=3,ncol=5),
 cellcolors=c("#ff0000","#ddcc00","#00ff00","#00ddcc","#0000ff",
 "#886644","#668844","#44bb22","#448866","#446688",
 "#aa00aa","#ccccaa","#88ddaa","#88aadd","#cc88ee"))

What I have done is to start with five base colors and vary saturation 
and brightness sort of orthogonally. I just did this one by guess and by 
gosh and only had to change one color. You don't have to use 
color2D.matplot, but it is easy to compare the colors if they are in a 
rectangular block.

Jim




More information about the R-help mailing list