【发布时间】:2015-01-24 09:44:33
【问题描述】:
我使用 searchtwitter 函数从 twitter 中提取了推文,并创建了一个包含“经度”和“纬度”列的 csv 文件,并创建了一个变量“tweets”来读取 csv 文件。每条推文/行都有经度和纬度数据。我想将推文的位置绘制到新加坡的谷歌地图上。
如何在使用 PlotOnStaticMap 函数创建的谷歌地图上绘制点?这是实现我的谷歌地图的代码:
sgmap<-GetMap(center="Singapore",zoom=11)
PlotOnStaticMap(sgmap)
points(tweets$longitude,tweets$latitude,col="red",cex=.6)
我也试过这个代码:
sgmap<-GetMap(center="Singapore",zoom=11)
PlotOnStaticMap(sgmap,cex=.6,col="red",FUN=points,add=F)
points(tweets$longitude,tweets$latitude,col="red",cex=.6)
和:
sgmap<-GetMap(center=c(1.352083,103.8198),zoom=11,destfile="map.png",maptype="satellite")
PlotOnStaticMap(lat=tweets$latitude,lon=tweets$longitude,zoom=11,cex=.6,col="red",FUN=points)
【问题讨论】:
-
试试
PlotOnStaticMap(sgmap, lat=tweets$latitude, lon=tweets$longitude, col="red",cex=.6) -
我试过了,我得到了这个错误: MaxZoom(latR,lonR,size) 中的错误:缺少参数“size”,没有默认值
标签: r google-maps twitter plot