title: Colors for heatmap in R
body: <p>I'm making a heatmap in R, but being very new to R, I have some questions:</p>
  
  <p>My data is a big matrix 21 columns and 89 rows, containing numbers from 0 to 16. I would like to get the heatmap colored in a heatmappy way from 0 (white) to 16 (dark red - or any color for that sake). Or maybe even fancier, have a color palette going from 0 to &lt;10 (so that the points having above 10 "hits" get the same color).  </p>
  
  <p>Can anyone help me with this ? Thanks alot!</p>
  
  <p>My code:</p>
  
  <pre><code>library(ggplot2)
  library("RColorBrewer")
  
  AS &lt;- read.csv("L:/Pseudoalteromonas/Heatmap antismash/HM_phyl.csv", sep=";")
  
  row.names(AS) &lt;- AS$Strain
  
  AS &lt;- AS[,2:21]
  
  ## The colors you specify.
  my_palette &lt;- colorRampPalette(c("white", "yellow","orange", "red"))(n = 299)
  
  AS_matrix &lt;- data.matrix(AS)
  
  AS_heatmap &lt;- heatmap(AS_matrix, Rowv=NA, Colv=NA, col = my_palette, scale="row", margins=c(5,10))
  </code></pre>
  
  <p>My data looks like this:</p>
  
  <pre><code>tail(HM)
     Sideophore Bacteriocin Aryl.polyene Nrps T1pks T2pks T3pks T1pks.Nrps Lantipeptide Terpene Hserlactone Transatpks
  
  S4048          0           2            0    2     0     0     0          0            1       0           0          1
  S3655          1           2            2    0     0     0     0          0            0       0           0          0
  S4060          0           2            0    7     0     1     1          2            1       0           0          1
  S2607          0           2            0   10     1     1     1          4            1       0           0          1
  S4054          0           2            1    3     0     0     0          4            1       0           1          1
  S4047          0           2            1    7     0     0     0          4            1       0           1          1
    Butyrolactone Indole Thiopeptide Ladderane Pufa Resorcinol Otherks Other
  S4048             0      0           0         0    0          0       0     0
  S3655             0      0           0         0    0          1       0     0
  S4060             0      1           0         0    0          0       0     2
  S2607             0      1           0         0    0          0       0     2
  S4054             0      1           0         1    0          0       0     0
  S4047             0      1           0         1    0          0       0     2
  </code></pre>