Creating a regional map of the USA


I'm trying to produce a map similar to this one:

I found some code to produce a somewhat similar map to get me started. However, the regions outside of the US mainland are omitted from the output. It seems like map_data('state') does not include all US regions.

I would appreciate some direction to get the desired map.

Thank you in advance!

library(ggplot2) <-  map_data('state')

# add PADD zones$PADD[$region %in% 
          c("maine", "vermont", "new hampshire", "massachusetts", "connecticut", "rhode island",
            "new york", "pennsylvania", "new jersey", "delaware", "district of columbia", "maryland",
            "west virginia", "virginia", "north carolina", "south carolina", "georgia", "florida")] <- "PADD 1: East Coast"$PADD[$region %in% 
          c("south dakota", "north dakota","nebraska", "kansas", "oklahoma", 
            "minnesota", "iowa", "missouri", "wisconsin", "illinois", "indiana",
            "michigan", "ohio", "kentucky", "tennessee")] <- "PADD 2: Midwest"$PADD[$region %in% 
          c("new mexico", "texas", "arkansas", "louisiana", "alabama", "mississippi")] <- "PADD 3: Gulf Coast"$PADD[$region %in% 
          c("montana", "idaho", "wyoming", "utah", "colorado")] <- "PADD 4: Rocky Mountain"$PADD[$region %in% 
          c("washington", "oregon", "nevada", "arizona", "california")] <- "PADD 5: West Coast"

# subset the dataframe by padd zones and move lat/lon accordingly$lat.transp[$PADD == "PADD 1: East Coast"] <-$lat[$PADD == "PADD 1: East Coast"]$long.transp[$PADD == "PADD 1: East Coast"] <-$long[$PADD == "PADD 1: East Coast"] + 5$lat.transp[$PADD == "PADD 2: Midwest"] <-$lat[$PADD == "PADD 2: Midwest"]$long.transp[$PADD == "PADD 2: Midwest"] <-$long[$PADD == "PADD 2: Midwest"]$lat.transp[$PADD == "PADD 3: Gulf Coast"] <-$lat[$PADD == "PADD 3: Gulf Coast"] - 3$long.transp[$PADD == "PADD 3: Gulf Coast"] <-$long[$PADD == "PADD 3: Gulf Coast"]$lat.transp[$PADD == "PADD 4: Rocky Mountain"] <-$lat[$PADD == "PADD 4: Rocky Mountain"]$long.transp[$PADD == "PADD 4: Rocky Mountain"] <-$long[$PADD == "PADD 4: Rocky Mountain"] - 5$lat.transp[$PADD == "PADD 5: West Coast"] <-$lat[$PADD == "PADD 5: West Coast"] - 2$long.transp[$PADD == "PADD 5: West Coast"] <-$long[$PADD == "PADD 5: West Coast"] - 10

# add labels
states <- aggregate(cbind(long.transp, lat.transp) ~ region,, 
states$labels <- c("AL", "AR", "AZ", "CA", "CO", "CT", "DE", "DC", "FL", "GA", "IA", 
              "ID", "IL", "IN", "KS", "KY", "LA", "MA", "MD", "ME", "MI", "MN", 
              "MO", "MS", "MT", "NC", "ND", "NE", "NH", "NJ", "NM", "NV", "NY", 
              "OH", "OK", "OR", "PA", "RI", "SC", "SD", "TN", "TX", "UT", "VA", 
              "VT", "WA", "WI", "WV", "WY")

# plot and use padd zone as fill
ggplot(,  aes(x=long.transp, y=lat.transp), colour="white") + 
  geom_polygon(aes(group = group, fill=PADD)) +
  geom_text(data=states, aes(long.transp, lat.transp, label=labels), size=3) +
  theme(panel.background = element_blank(),  # remove background
    panel.grid = element_blank(), 
    axis.line = element_blank(), 
    axis.title = element_blank(),
    axis.ticks = element_blank(),
    axis.text = element_blank()) +

Created on 2022-06-03 by the reprex package (v2.0.1)

To solve this issue, I used QGIS to download, edit and export a shapefile of the HHS Regions.

This topic was automatically closed 7 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.