Filled ocean in PlotEquiMap
Hi @aho
I have wonder sometimes why it is not straightforward to fill the ocean in PlotEquiMap as fill continents. Today, a user has asked me about this too.
I have found the following code that fills ocean using maps package as usual:
library(maps)
image(x=-90:-75, y = 25:40, z = outer(1:15, 1:15, "+"),
xlab = "lon", ylab = "lat")
map("state", add = TRUE)
outline <- map("usa", 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")
I let here this note in case we consider it worth it and we have time to improve PlotEquiMap.
Cheers,
Núria