I would like to colour the area above the diagonal as red and below as green with ggplot. I have read through geom_ribbon, but as far as I have understood I can only specify the y-value. Can somebody please support? Thank you very much.
# Test data
df <- data.frame(
x = sample(1:100, 100, replace=FALSE),
y = sample(1:100, 100, replace=FALSE))
library(ggplot2)
g <- ggplot(data=df, aes(x=x, y=y))
g +
geom_point() +
geom_abline(intercept = 0, slope = 1)
# + geom_ribbon(aes(ymin=2 , ymax=50), fill="red", alpha=0.2) not working