I plotted a US map in which different counties are colored according to the value of a quantity called AQI. The code is the following:
my_data %>%
ggplot() +
geom_sf(mapping = aes(fill = AQI, geometry = geometry),
color = "#ffffff", size = 0.05) +
coord_sf(datum = NA) +
scale_fill_continuous(low = "green", high = "orange", guide = guide_colorbar(nbin=10))
labs(fill = "AQI")
The color bar next to the map displays a continuous gradient of colors from green to orange. What I really want, though, is the bar to display only one shade of green from 0 to 50; one shade of yellow from 51 to 100; and one shade of orange above 100. How can I do that?