I'm trying to make a choropleth map of counties in the US. My values have a large range, and are highly 0 inflated, so I would like to create custom bins for the legend and coloring. Ideally this would be using ggplot. I would also like to keep a standard structure for the legend so that I can use the same legend for multiple choropleths with different data.
The legend might be something 0, 1-20, 21-50, 51-150, 151-300, 301-800, with each "bin" having its color derived from Spectral or some other continuous color palette.
scale_color_steps(), scale_fill_brewer() and other similar functions, even with breaks and limits or n.breaks, don't seem to work. Any ideas?
library(choroplethr)
library(choroplethrMaps)
library(ggplot2)
data(county.regions)
df <- tibble(region = county.regions$region, value = c(rep(0,2000), rep(1,1000), sample(2:800, 143)))
county_choropleth(df) +
scale_colour_steps(palette='Spectral', n.breaks = 8)

