pdil / usmap

🗺 Create US maps including Alaska and Hawaii in R
https://usmap.dev/
GNU General Public License v3.0
74 stars 16 forks source link

Issue with plotting maps that include Connecticut #88

Closed jerryli822 closed 6 months ago

jerryli822 commented 7 months ago

Describe the bug When using the plot_usmap function with any dataset that includes Connecticut, the area for Connecticut appears as blank.

To Reproduce Using your example:

"library(ggplot2)

mt <- plot_usmap("states", include = .mountain, labels = TRUE)

fl <- plot_usmap("counties", data = countypov, values = "pct_pov_2014", include = "FL") + scale_fill_continuous(low = "green", high = "red", guide = "none")

ne <- plot_usmap("counties", data = countypop, values = "pop_2015", include = .new_england) + scale_fill_continuous(low = "blue", high = "yellow", guide = "none")

cowplot::plot_grid(mt, fl, ne, nrow = 1)"

----> Connecticut on the third map is completely dark (N/A).

pdil commented 6 months ago

Yes, as of the 2022 shapefiles Connecticut counties have different FIPS codes (more info here: https://www.federalregister.gov/documents/2020/12/14/2020-27459/change-to-county-equivalents-in-the-state-of-connecticut). As such any datasets that use the old codes won't map correctly to the counties. Thank you for the report though, this is a good reminder to update the included datasets in this package as they are now quite old.

pdil commented 6 months ago

The most recent poverty data set is from 2021 so it doesn't include the Connecticut changes yet. In the next usmap update you'll be able to see Connecticut counties plot correctly with the countypop data set but not countypov yet. Maybe this year there will be a new update which I can include when it's available.