[R-sig-Geo] centering map on Pacific Basin instead of Greenwich
Chris Lusk
chris.lusk at waikato.ac.nz
Wed Nov 30 01:40:26 CET 2016
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.
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]]
More information about the R-sig-Geo
mailing list