color palette for heatmap?

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

color palette for heatmap?


Does anyone know how I can specify the colors based on the data values in heatmap?
I have values ranging from -4 to 25 and I want to specify colors as:

-4 = white
0 = white/snow
10 =darkblue
20 = red
25 = dark red

the command line that I am currently using is (which is close to what I want but not exactly)
col=colorRampPalette(c("-5" = "white","5" = "white", "10" = "darkblue", "20" = "red"))(4)
can I get a smooth transition in heatmap colors from white to blue to red in R?