[R] filled.contour ON TOP of a base map

Ray Brownrigg Ray.Brownrigg at ecs.vuw.ac.nz
Thu Apr 15 23:45:20 CEST 2010

On Thu, 15 Apr 2010, Víctor Homar Santaner wrote:
> Anyone?
The answer appears to be "no".

Going back to your original question though, you could just not fill the map.  I.e.

Otherwise, you may have to do things the 'hard way': set up two regions, draw a map in the 
first, (here you can then use polygon to colour the ocean green, then overlay the map 
again), overlay your filled contour (perhaps again using polygon), then set up the legend 
in the other region.

Hope this helps,
Ray Brownrigg

On Wed, 14 Apr 2010, Víctor Homar Santaner originally wrote:
> Dear R helpers,
> Any suggestion on how to make the 2D gaussian to show up ON TOP of the map,
> instead of below the continents?
> Example code:
> library(mapdata)
> x<-seq(-15,15,.2);y<-seq(30,55,.2)
> expone<-function(x,y){10*exp(-sqrt(x*x+(y-40)*(y-40))/2)}
> z<-outer(x,y,expone)
> filled.contour(x,y,z,levels=c(2,4,6,8,10),plot.axes=map("worldHires",add=T,
> Also, any idea on how to fill the ocean with a background color (e.g.
> green)?
> Best regards and thank you,
> Víctor.

More information about the R-help mailing list