【发布时间】:2015-01-28 08:23:34
【问题描述】:
我的目标是制作一张地图并将位置放在该地图上。它与R geom_point and ggmap 类似,但我可以得到地图,但连点显示都很难。
这是我正在使用的代码。
require(ggmap)
library(ggmap)
pp<- data.frame(lat=c(48.8535, 48.85418333, 48.86253333, 48.86373333, 48.86698333, 48.87033333, 48.87281667, 48.86993333, 48.87718333, 48.86251667,
48.85313333, 48.89153333, 48.88231667, 48.84368333, 48.84221667, 48.84473333, 48.8335, 48.86961667, >48.84681667), lon=c(-122.5735333, -122.54085, -122.5142667,
-122.4969667, -122.4857333, -122.4646, -122.44245, -122.4372167, -122.4128167, -122.4298, -122.48205, -122.40875, -122.4423833, -122.55515, -122.5196667, -122.52105
, -122.5086333, -122.4067667, -122.4358833))
tenmile <- get_map(location = c(lon = -122.486328, lat = 48.862813),
color = "color",
source = "google",
maptype = "roadmap",
zoom = 12)
ggmap(tenmile,
extent = "device",
ylab = "Latitude",
xlab = "Longitude")
p<- ggmap(tenmile) + geom_point(data=pp, aes(x=lon, y=lat), color="red", size=30, alpha=0.5)
【问题讨论】: