If I am making a stat_density_2d plot, with raster geometry, how can I color one part of the chart one color, another part of the chart another?
So for this chart:
d <- ggplot(data, aes(xVal, yVal))
d + stat_density_2d(geom = "raster", aes(fill = ..density..), contour = FALSE) +
scale_fill_gradient2(low = "white",
high = "#1A6AFF", space = "Lab", limits=c(0.00000, 0.00008), guide = "colourbar") +
geom_point() + xlim(-100,100)
How might I fill between -100 and 0 from a white to red gradient, and the 0 to 100 part of the plot with a white to blue gradient? Note that the fill is based on density, so it would just be splitting the chart into two parts, not creating a continuous scale along -100 to 100.