Hi R-help I am trying to mask the ocean from an image plot I have made.
Here is some example code: 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") As you can see, the polypath is on both sides of the country outline. Any help is much appreciated. Louise [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.