我想创建一个不完全正方形但是矩形的地图,这是我指定的尺寸。
require(ggmap)
tenmile <- get_map(location = c(lon = -122.486328, lat = 48.862813),
color = "color",
source = "google",
maptype = "roadmap",
zoom = 12)
tenmile.map <- ggmap(tenmile,
extent = "device",
ylab = "Latitude",
xlab = "Longitude")+ggtitle("GEOMean for Data from Oct 2013-Nov 2014")
tenmile.map + geom_point(data=pp, aes(x=lon, y=lat, size=geomean), color="red", alpha=0.5) +
geom_text(data=pp, aes(x=lon, y=lat, label = site), size=3, vjust = 1.25, hjust = -0.1)
我会发布我得到的和我想要的图片但是我没有足够的声望点来发布图片。 = - (
答案 0 :(得分:3)
如果要保留边界框的原始限制,只需更改其形状,可以调整纵横比。如果要更改边界框的限制,请像以前一样获取地图,但使用coord_fixed()
(或coord_cartesian()
)设置其限制。或者,您可以调整宽高比和边界框的限制。
tenmile <- get_map(location = c(lon = -122.486328, lat = 48.862813),
color = "color",
source = "google",
maptype = "roadmap",
zoom = 12)
tenmile.map <- ggmap(tenmile,
ylab = "Latitude",
xlab = "Longitude")+ggtitle("GEOMean for Data from Oct 2013-Nov 2014") +
coord_fixed(xlim = c(-122.55, -122.40), ratio = 2/1)