R ggplot2 - How do I specify out of bounds values' colour
Solution 1:
As you said youself, you want the oob
argument in the scale_fill_gradient
. To clamp values, you can use squish from the scales package (scales
is installed when ggplot2
is installed):
library(scales)
and later
scale_fill_gradient(low = "red", high = "green", limits=c(0.6, 1), oob=squish)