我遇到了同样的问题(在尝试绘制 Antartica 时)并且为了解决它,我求助于ggplot
,但依赖于ggmap
包中的几个函数。正如@Henrik 的链接所暗示的那样,地图投影似乎是问题所在。
整个想法和代码由 David Kahle 提供
您可以采取以下措施使其适用于您的案例:
location <- get_map(location = c(lon = 0, lat = 80), zoom = 4, maptype = "hybrid")
#Create a small data frame to pass to ggplot
fourCorners <- expand.grid(
lon = as.numeric(attr(location, "bb")[, c("ll.lon", "ur.lon")]),
lat = as.numeric(attr(location, "bb")[, c("ll.lat", "ur.lat")])
)
# The inset_raster function needs 4 data coordinates. Pull it out of your "location" that you got via get_map
xmin <- attr(location, "bb")$ll.lon
xmax <- attr(location, "bb")$ur.lon
ymin <- attr(location, "bb")$ll.lat
ymax <- attr(location, "bb")$ur.lat
# Now you are ready to plot it
mp <- ggplot(fourCorners, aes(x = lon, y = lat) ) +
inset_raster(location, xmin, xmax, ymin, ymax)
mp
它为您提供了以 (Longitude=0, lat=80) 为中心的“混合”地图
