title: Color Side Bars in heat map and dendrogram
body: <p>I am trying to add the color side bar to the heat map columns. </p>
  
  <p>My cases/samples belongs to different groups/classes (like e.g. samples are the results of many genes expression in various cells and groups are different species). </p>
  
  <p>I would like the color side bar to reflect different species. The column are labelled already by the type of the cell. I know that I can assign different colors to different species (using if and else) one by one but having more than 20 species and over 200 samples it is not practical. Same it is not practical to sort the data by the group and assign the different colors to e.g. samples 1 to 10, 11 to 25, etc... </p>
  
  <p>I have found that <code>as.character(as.numeric(data[,XXX])</code>, where <code>XXX</code> is the column with my groups names works fine. However it delivers appalling colors. Any suggestion how to apply e.g. just a few shades from rainbow colors to it? </p>
  
  <p>colCol from <code>heatmap.2</code> seemed to be suitable but when used it is ignoring the same class/group and assigning e.g. the palette of colors across all the samples... </p>
  
  <p>Further to the above I am wondering how to do the same when just the dendrogram is plotted. It seems to be even more complicated...
  Will appreciate any help!</p>