I can't figure out how to define fixed cutoffs in a gradient fill. This is an example on the iris data:
ggplot(iris, aes(x=Sepal.Length,
y=Sepal.Width,
fill=Petal.Length))+
geom_point(shape=21)+
scale_fill_gradientn(colors=c("white","black","darkred","red"))
In my actual data, I have a heatmap with many values 0, a lot between 1-10, a few outliers in the hundreds and thousands.
I would like the gradient to be:
- 0 = white
- 1-10 = from gray to black
- 11-100 = from black to darkred
- 101-1000 = from darkred to red
- over 1000 = purple
I don't want to transform it in a factor with bins, because I do want to maintain the continuous gradient especially at the low parts of the scale.
Thank you for you help