Having trouble creating choropleth of the U.S. using ggplot2 in RStudio

Viewed 22

I'm trying to create a choropleth of the percentages of individuals fully vaccinated against COVID-19 in the United States. I was able to throw some code together using ggplot, but when I run it, it only shows Alaska, Hawaii, and a couple of fragments of other states. The legend is also incorrect.

# Read in vaccine dataset through the wizard, named the dataframe "USVax" 

# Get map data of the world
mapdata <- map_data("world")

# Rename "state" column to "subregion" so that we can use left_join
USVax <- rename(USVax, subregion = state)

# Join dataframes
mapdata <- left_join(mapdata, USVax, by = "subregion")

# Get rid of extra rows that are not in the U.S.
mapdata1 <- mapdata %>% filter(!is.na(mapdata$People_Fully_Vaccinated))

# Make plot
map1 <- ggplot(mapdata1, aes(x = long, y = lat, group = group)) +
  geom_polygon(aes(fill = People_Fully_Vaccinated), color = "black")

The following choropleth is produced:

choropleth

0 Answers
Related