Skip to content

plot filled.contour over continent map

4 messages · Matthias Demuzere, Greg Snow, Ray Brownrigg

#
On Fri, 20 Nov 2009, Matthias Demuzere wrote:
Does the filled.contour() call work on its own? It should, right?

What I would expect to see is just the contour plot, since that should overwrite the map() 
plot.

Once you get filled.contour() working, try adding the map using:
map('worldHires',xlim=c(-10,40),ylim=c(35,70),boundary = TRUE, border=0.1, add = TRUE)

You may have to put the xlim= and ylim= into the filled.contour() call to get what you 
want.

HTH
Ray Brownrigg
#
You probably want to put the map boundaries on top of the contour plot rather than the other way around.  Here is one example of doing that (find the correct asp may be the hardest part):

library(maps)

x <- seq( -124.7, -67, length.out=25 )
y <- seq( 25, 49, length.out=25 )

z <- outer(x,y,'+')

filled.contour(x,y,z, asp=1.5, plot.axes=map('state',add=TRUE)  )

hope this helps,
4 days later
#
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: