title: R gplots: Heatmap with side colours
body: <p>I want to create a heatmap using the <code>heatmap.2</code> function from the <code>gplots</code> package. This is a minimal example.</p>
  
  <pre><code>require(gplots)
  
  # create symmetric matrix
  x = matrix(rnorm(100), nrow=10)
  diag(x)         &lt;- 1
  x[upper.tri(x)] &lt;-  t(x)[upper.tri(x)]
  colnames(x)     &lt;- rownames(x) &lt;- letters[1:nrow(x)]
  
  # create side colours
  varcols = setNames(rainbow(nrow(x)), rownames(x))
  
  # create heatmap
  heatmap.2(x,
            symm = TRUE,             
            trace = "none",          
            revC=TRUE, # &lt;-- THIS IS THE PROBLEM
            ColSideColors = varcols,
            RowSideColors = varcols
            )  
  </code></pre>
  
  <p>The problem are the sidecolors. <code>x</code> is a symmetric matrix, thus columns and rows should have the same sidecolors. This is fine as long as <code>revC = FALSE</code>. However, when I use <code>revC = TRUE</code> the order of the colors is messed up. Sometimes - in small examples - it helps to reverse the <code>ColSideColors</code>, but that doesn't always work.</p>
  
  <p>Am I doing anything wrong or is this a <code>gplots</code> bug?</p>