[R-sig-Geo] centering map on Pacific Basin instead of Greenwich

Roger Bivand Roger.Bivand at nhh.no
Wed Nov 30 10:06:31 CET 2016


On Wed, 30 Nov 2016, Chris Lusk wrote:

> Hello all
>
> I'm making a global map of average leaf size in forests, using different
> colours to show dominance of different leaf size classes. The world map is
> of course centred on Greenwich (longitude zero) but none of my data are
> from Europe or Africa, so a map centred on the Pacific basin would look
> much better. In fact I'd like to cut Europe and Africa right out of the map
> (nothing personal about this!).
>
> Online I've seen several suggestions for re-centering the map, but they
> haven't worked for me. I would really appreciate suggestions about how to
> achieve this.

mapdata comes with world2Hires, which is Pacific centred. However, the 
polygons are not split at 0, so wrap around if you need to fill. I think 
your xlim= values are incorrect too, I get a Pacific basin from:

map("world2Hires", xlim=c(135, 290), ylim=c(-60,70), lty=1,
  interior=FALSE)

but as lines not filled polygons.

Roger

>
> My map code is pasted in below, and the data can be downloaded at
> http://sci.waikato.ac.nz/sites/clusk/DivrepNZ.csv
>
> cheers
>
> Chris
> ............
>
> library(maps)
> library(mapdata)
> library(maptools)
>
> ###Get world map and fill landmasses to hide national borders
> map("worldHires", xlim=c(-165,180),ylim=c(-60,70),lty=1, col="gainsboro",
> fill=TRUE, border="gainsboro")
>
> ###Show axes with horizontal tick labels
> map.axes(cex.axis=0.75, las=1)
>
> ###Make axis titles
> title(xlab = "Longitude (degrees E)", ylab="Latitude (degrees S)")
> ##Get site location data to plot
>
> Data = read.csv("DivrepNZ.csv")
>
> Mesophyll = subset (Data, Size == "Mesophyll", select = c("Size", "ID",
> "lon", "lat"))
> Notophyll = subset (Data, Size == "Notophyll", select = c("Size", "ID",
> "lon", "lat"))
> Microphyll = subset (Data, Size == "Microphyll", select = c("Size", "ID",
> "lon", "lat"))
> Nanophyll = subset (Data, Size == "Nanophyll", select = c("Size", "ID",
> "lon", "lat"))
>
> points(Mesophyll[,"lon"], Mesophyll[,"lat"],pch=15, cex=0.6, col="red3")
> points(Notophyll[,"lon"], Notophyll[,"lat"], pch=15, cex=0.6, col="orange")
> points(Microphyll[,"lon"], Microphyll[,"lat"], pch=15, cex=0.6,
> col="green3")
> points(Nanophyll[,"lon"], Nanophyll[,"lat"], pch=15, cex=0.6, col="blue")
>
>
>
>
> *- - - - - - -*Chris Lusk
> Environmental Research Institute
> University of Waikato
> Hamilton
> New Zealand
> Senior Editor, *New Zealand Journal of Botany*
>
> 	[[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>

-- 
Roger Bivand
Department of Economics, Norwegian School of Economics,
Helleveien 30, N-5045 Bergen, Norway.
voice: +47 55 95 93 55; fax +47 55 95 91 00
e-mail: Roger.Bivand at nhh.no
http://orcid.org/0000-0003-2392-6140
https://scholar.google.no/citations?user=AWeghB0AAAAJ&hl=en
http://depsy.org/person/434412



More information about the R-sig-Geo mailing list