title: R: heatmap does color does not correspond to data
body: <p>I am new to R and have a question about heatmaps. </p>
  
  <p>I have a list of proteins on the rows and in the columns their respective abundance in different conditions. This data are normalized, so in each row there is a 1 standing for the maximum and the rest of the values are between 1 and 0. I set 1 as red and 0 as white. </p>
  
  <p>When I plot the heatmap with a scale though, I don't have a red square (=1) in each row, as it should be. </p>
  
  <p>This is the code I have been using: </p>
  
  <pre><code>df &lt;- read.table("my_data.txt", header = TRUE)
  row.names(df) &lt;- df$name
  df &lt;- df[, 2:21]
  df_matrix &lt;- data.matrix(df)
  breaks = seq(0, max(df), length.out = 1000)
  gradient1 = colorpanel( sum( breaks[-1]&lt;=1 ), "white", "red" )
  gradient2 = colorpanel( sum( breaks[-1]&gt;1), "black", "red")
  hm.colors = c(gradient1, gradient2)
  df_heatmap &lt;- heatmap(df_matrix, 
                    Rowv=NA, 
                    Colv=NA, 
                    col=hm.colors, 
                    scale = "column", 
                    margins = c(5,10)) 
  </code></pre>
  
  <p>I also tried other options, like: </p>
  
  <pre><code>df_heatmap &lt;- heatmap(df_matrix, 
                    Rowv=NA, 
                    Colv=NA, 
                    col=heat.colors(256),
                    scale = "column", 
                    margins = c(5,10)) 
  </code></pre>
  
  <p>If you have any suggestion on how to adjust it, it would be great. Thank you for the help! </p>