I have the following code:
library(tidyverse)
exp<-data.frame(a=c(10,30,80,100),b=c("A","B","C","D"))
exp %>%
ggplot(aes(b,a))+
geom_rect(aes(xmin="A",xmax="D",ymin=0,ymax=50,fill="red")) +
geom_point()
As you can see, the values for "A" and "D" are on the borders of the rectangle provided by geom_rect(). How can I get geom_rect() to start at x=0 and use the entire width of the plot? I want to use errorbars in my dataset and they are halfway outside the rectangle this way.


