Date: Tue, 3 Feb 2004 11:34:06 +0100 (CET)
From: Roger Bivand <Roger.Bivand at nhh.no>
On Tue, 3 Feb 2004, Janus Larsen wrote:
Hi R-Help,
I would like to make filled contour maps of ocean data overlaid by
costlines from the map package.
I can draw the filled contours and the coastlines om the same plot, but
the filled contour also covers part of the land. To get rid of that I
tried to draw a filled coastline map on top of the filled contour, but
the filled map only draws the closed contours - so most of the land is
missing.
Example:
map("worldHires",xlim=c(0,15),ylim=c(50,60)) #Draw relevant region
(North Sea and Denmark waters)
map("worldHires",xlim=c(0,15),ylim=c(50,60),fill=TRUE) # This only draws
Denmark and Holland (Sweden, uk, Germany etc. disappears because they
are not closed polygons).
Looks as though you can use the regions= argument:
res <- map("worldHires",xlim=c(0,15),ylim=c(50,60), plot=FALSE,
map("worldHires",xlim=c(0,15),ylim=c(50,60))
map("worldHires",regions=res, fill=TRUE, add=TRUE)