How to make census region border thicker on usmap packake R?

452 Views Asked by At

I am looking to display county level data on a US map, but also include those state borders that delimit the census regions (Northeast, Midwest, West and South) to be thicker. In this way, I am trying to make the map represent both the county level data and make it easy to distinguish between different census regions.

As an example below, I am able to make the county boundaries thin, but can't find a way to make the region boundaries thicker.

plot_usmap(data = countypop, , size = 0.05, color = "black", values = "pop_2015") + 
    scale_fill_gradient2(
        low = "blue", mid = "white", high = "red", midpoint = 0, name = "County population", label = scales::comma
    ) 
1

There are 1 best solutions below

0
On

You can add an extra polygon layer to your map with state outlines like so:

plot_usmap(data = countypop, , size = 0.05, color = "black",
           values = "pop_2015") + 
    scale_fill_gradient2(
        low = "blue", mid = "white", high = "red", midpoint = 0, 
        name = "County population", label = scales::comma) +
  geom_polygon(data = usmapdata::us_map(regions = "states"),
               aes(x, y, group = group), fill = NA, size = 1, color = "black")

enter image description here

As far as I can tell, there are no regional outlines included in the package. A subtle fill color for each region would be possible, but to get full regional outlines would most likely require converting all state outlines to spatial data, carrying out a merge, then converting them back to xy co-ordinates. Certainly not impossible, but quite a bit of work.