I am trying to plot some global maps (raster files) and I have some problems in setting up a good color scale for my data. What I would like to do is to plot my data using a divergent palette (e.g. cm.colors), and I would like to center the color "white" of such scale with the value zero, but without having to set symmetric values in the scale (i.e. the same value both negative and positive, i.e. limits=c(-1,1)). Additionally, I would like to plot all values above and/or below a certain value all with the same color.
In other words, if we suppose that my map has a range of -100 to 150, I would like to plot my map with a diverging palette with a "white" color corresponding to the value 0, and having all values e.g. below -20 and above 50 plotted with the same color, i.e. respectively with the negative and positive extremes of the color palette.
Here an example of the code that I am using for the moment:
ggplot(df, aes(y=Latitude, x=Longitude)) +
geom_raster(aes(fill=MAP)) +
coord_equal()+
theme_gray() +
theme(panel.background = element_rect(fill = 'skyblue2', colour = 'black'),
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "right",
legend.key = element_blank()) +
scale_fill_gradientn("MAP", limits=c(-0.5,1), colours=cm.colors(20))



