I'd like to change the background of my R plot as shown in the picture below (see result plot). The plot has a bisector and I'd like the background above the bisector to be red and under the bisector to be green.
That's what I already tried, but unfortunately it doesn't work with ggplotly.
# The code
data <- data.frame(y=c(Inf,Inf,0), x=c(0,Inf,0), y_new=c(0,0,Inf),x_new=c(0,Inf,Inf))
test <- ggplot(data) +
geom_polygon(aes(x=x, y=y), colour="red",fill="red") +
geom_polygon(aes(x=x_new, y=y_new), colour="green",fill="green") +
geom_abline(slope = 1, intercept= 0)
ggplotly(test)
Thank you for every hint that might help me!