我想在澳大利亚部分地区的地图中掩盖海洋。
这是我的出发点:
library(maps)
library(mapdata)
image(x=110:155, y =-40:-10, z = outer(1:45, 1:30, "+"),
xlab = "lon", ylab = "lat")
然后,按照此处发布的解决方案(如何在美国地图中将海洋染成蓝色?),我设置了多路径:
outline <- map("worldHires", plot=FALSE) # returns a list of x/y coords
xrange <- range(outline$x, na.rm=TRUE) # get bounding box
yrange <- range(outline$y, na.rm=TRUE)
xbox <- xrange + c(-2, 2)
ybox <- yrange + c(-2, 2)
# create the grid path in the current device
polypath(c(outline$x, NA, c(xbox, rev(xbox))),
c(outline$y, NA, rep(ybox, each=2)),
col="light blue", rule="evenodd")][1]
然而,由此产生的情节在国家边界的两侧都被掩盖了。谁能帮我只在国外戴口罩?