How to use annotation for specfici facet?

How do I put annotation on a specific facet wrap that I want. I use this line of code :

plot_avg_time_temp_20 = ggplot(avg_time_temp_20,aes(x=mean_time,y=temperature))
plot_avg_time_temp_20 + geom_point(aes(color=temperature)) + 
  scale_color_gradient("Temperature",low = "green", high="red") +
                     breaks=c(-2,0,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30)) +
  labs(title="Cyclicstic Rides: Average Traveling Time vs. Temperature",
       subtitle = "Average of total ride duration a day for each month against the average temperature",
       caption = "Monthly average temperature of Chicago in 2020 was collect from Current Results",
       x= "Average Time (Minutes)",
       y= "Average Temperature (C)",
       legend = "Temperature") + 
        legend.position = "right",
        legend.title=element_text(face ="bold",size = 11),
        legend.background = element_rect(linetype = "solid",color = "black"),
        axis.title=axis_style) +
  annotate("rect",xmin=120,xmax=170,ymin=-1.5,ymax=2,alpha=0.2) +

It creates a plot like this and I only want the box to be on the casual wrap.

Use geom_rect() and the data argument to specify a subset of the data:
Rectangles — geom_raster • ggplot2 (

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.