用边界坐标绘制的ggmap

ggmap plotted with bounding coordinates

我正在尝试使用解决方案 here 在绘制 ggmap 时应用坐标边界框,因为使用边界框指定 get_map() 不起作用(转换为中心和缩放)。

但是,我的情节周围有很多额外的灰色。我想在边界坐标为 (xmin, xmax, ymin, ymax) = (-170,-30, -60, 110)

的地方很好地拟合一个图
# Get a Google satellite map of North and South America
map <- get_map(location = c(-100, 20), zoom = 2, maptype = "satellite", source = "google")
ggmap(map)

结果是:

我想要一个符合上述坐标的绘图。

# Attempt to scale the x and y axes
ggmap(map) + 
scale_x_continuous(limits = c(-170, -30), expand=c(0,0)) +
scale_y_continuous(limits = c(-60, 110), expand=c(0,0))

我最终得到的情节是这样的:

裁剪得很好,但顶部的灰色过多 space。

编辑:我在 RStudio 1.0.136 中使用 R 3.3.3,以及 ggmap 2.7 和 ggplot2 2.2.0

您尝试做的事情超出了地图的边界。墨卡托式投影的最大值 positive/negative Latitude85.0511... / -85.0511...,因为 arctan(sinh(Pi)) * 180 / Pi = 85.0511288

此代码将产生正确的结果:

ggmap(map, extent = "panel") + 
scale_x_continuous(limits = c(-170, -30), expand=c(0,0)) +
scale_y_continuous(limits = c(-60, 85), expand=c(0,0))