Insert US State abbreviation on Map togeter numbers with ggplot2

66 Views Asked by At

I have the following data set:

enter image description here

Then with this code:

ggplot(data= data.to.work.final, aes(map_id = State_L)) + 
geom_map(aes(fill = Suicide_Rate_By_Pop),  color= "white", map = fifty_states) + 
expand_limits(x = fifty_states$long, y = fifty_states$lat) +
coord_map() +
geom_text(data = fifty_states %>%
          group_by(id) %>%
          summarise(lat = mean(c(max(lat), min(lat))),
                    long = mean(c(max(long), min(long)))) %>%
          mutate(State_L = id) %>%
          left_join(data.to.work.final, by = "State_L"),  size=2, 
          aes(x = long, y = lat, label = Suicide_Rate_By_Pop)
          #aes(x = long, y = lat, label = state)
         ) +
scale_x_continuous(breaks = NULL) + 
scale_y_continuous(breaks = NULL) +
labs(x = "", y = "") + 
labs(fill = "Suicides Rate by 100,000 inhabitants")+
  
scale_fill_gradientn(colours=rev(heat.colors(10)),na.value="grey90",
                     guide = guide_colourbar(barwidth = 25, barheight = 0.4,
                                             #put legend title on top of legend
                                             title.position = "top")
                                            ) +
theme(legend.position = "bottom",
      legend.title=element_text(size=10), 
      legend.text=element_text(size=08))

I produced the following map of us with suicide rate inside of each state:

enter image description here

I would like to insert the abbreviation of each state and below the suicide rate, like:

CA

1433

Somebody would help please?**

0

There are 0 best solutions below