我是R的新手,仅通过使用教程就了解到了这一点。我的数据“地理位置”包含美国大约200个城市的坐标。
library("ggmap")
library("tidyverse")
library("dplyr")
library ("usmap")
library("ggplot2")
library("maps")
geolocation<-read.csv("mapdata.csv")
geolocation<-geolocation[,1:7]
names(geolocation)<-c("City","State","Country","Size","Status","Lat","Long")
map("state")
p <- ggmap(USA)
p <- p + geom_point(data=geolocation, aes(x= Long, y= Lat), size=Size, color=Status)