r - 如何获取经纬度范围内的 map ?

标签 r ggplot2 ggmap

如何使用 R 中的 ggmap 获取具有特定最小和最大纬度和经度限制的 map ?

我刚开始使用 ggmap,到目前为止我已经能够实现这个:

center <- c(mean(src$longitude),mean(src$latitude))
zoom <- min(MaxZoom(range(src$latitude),range(src$longitude)))
hdf <- get_map(location=center,zoom=zoom)

帮助文件说位置可以作为地址、经度/纬度对(按顺序)或左/下/右/上边界框来提及。我找不到任何关于在线实现 ggmap 边界框的有用 Material 。

最佳答案

我不确定你可以在下载阶段做到这一点,但是在绘图阶段怎么样:

map <- get_map()
p1 <- ggmap( map )
p2 <- ggmap( map )+
scale_x_continuous( limits = c( -95.5 , -95.3 ) , expand = c( 0 , 0 ) )+
scale_y_continuous( limits = c( 29.6 , 29.8 ) , expand = c( 0 , 0 ) )
require( gridExtra )
grid.arrange( p1 , p2 , nrow = 1 )

enter image description here

关于r - 如何获取经纬度范围内的 map ?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17843580/

相关文章:

r - 如何在数据集的所有列上计算回归并提取参数

r - 计算 data.table 中多个列表的长度

r - 沿x轴按组划分geom_point点

python - 如何使用 ggplot2 在 ipython notebook 中制作直方图(适用于 python)

r - 在 r 中动画 ggmap

r - 如何使用 ggmap -r 为国家/地区着色

r - H2O 在 R 中连接失败

R:高效从向量构造矩阵并用特定条件填充它

r - 在 ggplot 中将 x 轴标签指向内

r - 向与 ggmap 一起使用的数据添加一列