I have a spatial raster create in R with positive and negative values. I want for all positive values a red color ramp and for all negative values a blue color ramp. Basically I want to define my own color ramp with zero as blank, positive values in red, and negative values in blue (these can be any colors). Most color ramps in R spread all available colors between the min. and max. value.
I do not seem to be able to find the solution, so hopefully someone here has suggestions.
Here's an example for a raster with values between -5 and 5 for which I need a 'new' col definition:
library(raster)
set.seed(9)
r <- raster(ncol=10, nrow=10)
r1 <- setValues(r, (1:ncell(r))/10 + rnorm(ncell(r)) - 5)
plot(r1, col= topo.colors(12))
Best -- Niels