[R-sig-Geo] Adding a map to a filled.contour plot

Roger Bivand Roger.Bivand at nhh.no
Tue Oct 16 09:27:57 CEST 2007


On Tue, 16 Oct 2007, Anne GOARANT wrote:

> Dear List,
>
> I am using the filled.contour function with the argument plot.axis =
> {map('worldHires',add=T)} to add the world map to my plot.
>
> filled.contour(x,y,z,plot.axes = {map('worldHires',add=T,fill=T)})
>
> The problem is that the longitudes of my matrix go from 0 (at Greenwich)
> to 360 which seem not to be the same for the map function (whose
> longitudes go from -180 to 180). Hence only one part of the map appears
> on the plot (South Africa and Australia). Do you know a way to get the
> whole map on the plot?

Two possibilities: forego higher resolution and use "world2" in maps, or 
manipulate x in the filled.contours() call, something like (untried):

xx <- ifelse(x <= 180, x, -(360 - x))

which ought to work even if your x range extends below 0.

Roger


>
> Cheers,
>
> Anne
>
>
>
>
> ________ Information from NOD32 ________
> This message was checked by NOD32 Antivirus System for Linux Mail Servers.
> http://www.eset.com
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>

-- 
Roger Bivand
Economic Geography Section, Department of Economics, Norwegian School of
Economics and Business Administration, Helleveien 30, N-5045 Bergen,
Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43
e-mail: Roger.Bivand at nhh.no




More information about the R-sig-Geo mailing list