First of all I have to say that I read many threads about heatmap and ggplot2 here in stackoverflow and elsewhere. But my problem isn\'t solved yet.
I have got the foll
The problem of interpolating colors with a complex color scale is best illustrated on the "old faithful" data.
If you use your user defined "rainbow" color scale, the interpolation will not be doing so great (even if the result still looks quite good).
Without interpolation
library(ggplot2)
cols <- rev(rainbow(7)[-7])
ggplot(faithfuld, aes(waiting, eruptions)) +
geom_raster(aes(fill = density), interpolate = FALSE) +
scale_fill_gradientn(colours = cols)
With interpolation
ggplot(faithfuld, aes(waiting, eruptions)) +
geom_raster(aes(fill = density), interpolate = TRUE) +
scale_fill_gradientn(colours = cols)
With interpolation and a less complex palette
ggplot(faithfuld, aes(waiting, eruptions)) +
geom_raster(aes(fill = density), interpolate = TRUE) +
scale_fill_gradientn(colours = c("steelblue", "tomato"))