Add Points to Choropleth Map in ggplot2

前端 未结 1 464
别那么骄傲
别那么骄傲 2021-01-13 05:46

I\'m looking at the following example from Hadley Wickham\'s ggplot2:

library(ggplot2)
library(maps)
states<-map_data(\"state\")
arrests<-         


        
相关标签:
1条回答
  • 2021-01-13 06:02

    This seems to work just fine for me:

    base_map + 
        geom_point(aes(long, lat,fill = NULL,group = NULL), size = 1,data=us.cities) + 
        borders("state", size=.5)
    

    Although you may want to exclude the cities in HI and AK, as I did to produce this version of the plot:

    enter image description here

    0 讨论(0)
提交回复
热议问题