[R] plot filled.contour over continent map

Ray Brownrigg Ray.Brownrigg at ecs.vuw.ac.nz
Mon Nov 23 23:09:00 CET 2009


You just have to RTFM!

?filled.contour tells you you cannot add points (or lines) to a finished plot, and tells 
you how to do what you want.

So, based on your most recent offline message, try:

filled.contour(x, y, mslp, zlim = c(1000,1020),
  color.palette = colorRampPalette(c("blue", "lightblue", "yellow", "orange", "red")),
  xlab = "Longitude (°)", ylab = "Latitude (°)",
  xlim = c(-5, 40), ylim = c(35, 70), nlevels = 25,
  plot.axes = {axis(1); axis(2);			### this is the key part
    map('worldHires', xlim = c(-5, 40), ylim = c(35, 70), add = T, col = "darkgrey")}
)

Ray Brownrigg

On Fri, 20 Nov 2009, Matthias Demuzere wrote:
> Dear all,
>
> As a newbie in R I would like to do the following (simple?) thing:
>
> to plot a filled.contour plot over a map showing country boundaries (e.g.
> for Europe) What i do is:
> map('worldHires',xlim=c(-10,40),ylim=c(35,70),boundary = TRUE,border=0.1)
> map.axes()
> filled.contour(mslp, zlim=c(1000,1020),color.palette =
> colorRampPalette(c("blue", "white", "red")),main="Avegared MLSP (hPa) ERA40
> JJA [1996-2002]", xlab="Longitude",ylab="Latitude")
>
> in which the mslp file is a netcdf file, with mean sea level pressure for a
> range of lat/lon values.
>
> If I run the above-mentioned, I just get the map of Europe, without the
> contourplot. When commenting the "map" statements I can see the
> contourplot.
>
> So I am doing something wrong, but I really have no idea what?
>
> Anybody could help me out here?
> Thanks in advance,
>
> Matthias
>
> -------------------------------------------------------------
> Department of Earth & Environmental Sciences
> Physical and Regional Geography Research Group
> Regional climate studies
>
> Celestijnenlaan 200E
> 3001 Heverlee (Leuven)
> BELGIUM
>
> Tel: + 32 16 326424
> Fax: + 32 16 322980
>
> http://geo.kuleuven.be/aow/
> www.kuleuven.be/geography
> -------------------------------------------------------------
>
>
> 	[[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at 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.




More information about the R-help mailing list