An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20120809/551d25d6/attachment.pl>
How to overlay a global map on a filled contour?
2 messages · Cable, Sam B Civ USAF AFMC AFRL/RVBXI, Duncan Murdoch
On 12-08-09 6:14 PM, Cable, Sam B Civ USAF AFMC AFRL/RVBXI wrote:
I would like to plot some lat-lon data in a filled contour, and then
overlay a map of the globe on top. I am trying something like this:
filled.contour(lons, lats, glb.data,
plot.axes={axis(1);axis(2);map(projection='rectangular',parameters=0,add
=T)}
)
The filled contour plots fine, and the map shows up, but only as a very
tiny little black rectangle in a small area of the contour plot. Of
course, I want the map to stretch over the entire area of the filled
contour plot.
I've also tried something like:
filled.contour(lons, lats, glb.data,
plot.axes={axis(1);axis(2);map(projection='rectangular',x=lons,y=lats,pa
rameters=0,add=T)}
)
In this case, the map does not plot at all and I get an error message
"nothing to draw: all regions out of bounds"
People apparently do this successfully all the time, but I haven't been
able to get it to work. Can anyone tell me what I am doing wrong? BTW, I
don't want to use the lattice package. It will not work with the other
stuff my group is doing. Thanks.
Your code doesn't quite make sense. The map function doesn't want to
know the x and y values; it just wants to know the region to plot, which
should have been set by the data. So, assuming that
filled.contour(lons, lats, glb.data) produces something sensible, you'd
get what you want with
filled.contour(lons, lats, glb.data, plot.axes={axis(1); axis(2);
map(add=TRUE)})
Duncan Murdoch