Learn R Programming

mapmisc (version 1.7.0)

gridlinesWrap: Adds long-lat grid for projected data

Description

long-lat grid lines are added to a map in the coordinate system specified, allowing for map projections wrapped differently from the 180 meridian.

Usage

gridlinesWrap(crs, 
		easts=seq(-180,180,by=60),
		norths=seq(-90,90,by=30),
		ndiscr=40, plotLines=TRUE, 
		plotLabels = TRUE, ...)

Arguments

crs

A CRS object, proj4 string, or an object from which a projection can be extracted with proj4string(crs)

easts

vector of longitudes

norths

vector of latitudes

ndiscr

number of intermediate points per line

plotLines

add lines to existing plot

plotLabels

add labels to existing plot

Additional arguments passed to lines or text, for example lty=2

See Also

gridlines, llgridlines

Examples

Run this code
# NOT RUN {
Npoints = 20
myPoints = SpatialPointsDataFrame(
	cbind(
	runif(Npoints, -15000000, 15000000), 
	runif(Npoints, -8000000, 8000000)), 
	data=data.frame(y1=c(NA, rnorm(Npoints-1)), 
	y2=c(sample(0:5, Npoints-1,replace=TRUE), NA)),
	proj4string=moll(c(-100,0))
)


plot(myPoints)
gridlinesWrap(myPoints, lty=3, col='red')
# }
# NOT RUN {
# }

Run the code above in your browser using DataLab