Choropleth Map in ggplot2

library(tidyverse)
states<-as.data.frame(state.x77) %>%
  mutate(region=tolower(rownames(states)))

states_map <- map_data("state")
 
fact_join <- left_join(states_map, states, by = "region")

ggplot(fact_join, aes(long, lat, group = group))+
  geom_polygon(aes(fill = Population), color = "white")+
  # 将map颜色设置为“岩浆”色,简称为“A”,共有“A”,“B”,“C”,“D”和“E”五种
  scale_fill_viridis_c(option = "C")+
  theme_classic()


评论

此博客中的热门博文

V2ray websocket(ws)+tls+nginx分流

Rstudio 使用代理