R 在纬度/经度边界内绘制地图
我正试图用ggmap绘制一幅更广阔的印度洋地图。我选择了不同的纬度/经度,我想形成我的地图的角落。然而,当我尝试用R绘制地图时,它会生成一张所有大陆的地图,而不仅仅是我希望它绘制的区域。上面的地图是代码输出的,我已经突出显示了我希望在红色框中绘制的区域 这是我尝试的代码:R 在纬度/经度边界内绘制地图,r,ggplot2,ggmap,R,Ggplot2,Ggmap,我正试图用ggmap绘制一幅更广阔的印度洋地图。我选择了不同的纬度/经度,我想形成我的地图的角落。然而,当我尝试用R绘制地图时,它会生成一张所有大陆的地图,而不仅仅是我希望它绘制的区域。上面的地图是代码输出的,我已经突出显示了我希望在红色框中绘制的区域 这是我尝试的代码: bbox <- make_bbox(lon = data$Longitude, lat = data$Latitude, f=1) map <- get_map(location = bbox, source =
bbox <- make_bbox(lon = data$Longitude, lat = data$Latitude, f=1)
map <- get_map(location = bbox, source = "google", maptype = "satellite")
plot <- ggmap(map)
您的值f=1,太大了,这会扩大地图的大小
data<-structure(list(Latitude = c(18.682744, -27.706318, 17.65651,
-21.006735), Longitude = c(46.252432, 43.179057, 100.89364, 104.064258
)), class = "data.frame", row.names = c(NA, -4L))
bbox <- make_bbox(lon = data$Longitude, lat = data$Latitude, f=1)
bbox
#left bottom right top
#-17.70614 -74.09538 164.94946 65.07181
数据
data<-structure(list(Latitude = c(18.682744, -27.706318, 17.65651,
-21.006735), Longitude = c(46.252432, 43.179057, 100.89364, 104.064258
)), class = "data.frame", row.names = c(NA, -4L))
bbox <- make_bbox(lon = data$Longitude, lat = data$Latitude, f=1)
bbox
#left bottom right top
#-17.70614 -74.09538 164.94946 65.07181
bbox <- make_bbox(lon = data$Longitude, lat = data$Latitude, f=0.05)
box
# left bottom right top
#40.13480 -30.02577 107.10852 21.00220