我正在尝试使用“ggsn”包放置比例尺和指北针。但我收到一条错误消息:
错误:annotation_custom 仅适用于笛卡尔坐标
此外: 警告消息:
1:在 min(data$long) 中:没有非缺失的 min 参数;返回信息
2:在 max(data$long) 中:没有非缺失的 max 参数;返回 -Inf
3:在 min(data$lat) 中:没有非缺失的 min 参数;返回信息
4:在 max(data$lat) 中:没有非缺失的 max 参数;返回 -Inf
5:删除了 1374840 行包含非有限值 (stat_contour)。
我的代码是这样的:
#loading the map
world <- maps::map("world2", fill=TRUE, plot=FALSE) # world2 is the Pacific centered map with longitude [0,360]
IDs <- sapply(strsplit(world$names, ":"), function(x) x[1])
world <- map2SpatialPolygons(world, IDs=IDs, proj4string=CRS("+proj=longlat +datum=WGS84 +no_defs +ellps=WGS84 +towgs84=0,0,0"))
world_map <- fortify(world)
#load the bathymetry
bat <- marmap::getNOAA.bathy(lon1 = -5.0000, lon2 = -80.0000, lat1 …Run Code Online (Sandbox Code Playgroud)