You are using the cm.color
palette which is a cyan-purple palette.
You can create your own palette for instance using RColorBrewer.
RColorBrewer provides a red-yellow-green palette you can use
library(RColorBrewer)
pal <- colorRampPalette(brewer.pal(11, "RdYlGn"))(100)
brewer.pal
loads the palette (the palette has 11 colors, we're gonna use them all) and then colorRampPalette
interpolates it to 100 colors.
Alternatively you can define your own colors:
redgreen <- c("red", "green")
pal <- colorRampPalette(redgreen)(100)
After creating the palette just use it as the col
parameter to heatmap
.