Last data update: 2014.03.03

R: Start a new map
map.newR Documentation

Start a new map

Description

Prepare a plotting window suitable for a map

Usage

map.new(x,legendRight=FALSE, buffer=0, mar=c(0,0,0,0), ...)

Arguments

x

A spatial object from which an extent can be extracted.

legendRight

Leave room to the right for the legend produced by plotting a Raster object

buffer

passed to extend to increase the plotting area

mar

see par

...

Additional arguments passed to plot

Details

map.new initiates a plot intended to contain a map covering the extent of x, with no margins.

Author(s)

Patrick Brown

See Also

scalebar, spplot

Examples


Npoints = 20
myPoints = SpatialPointsDataFrame(
	cbind(runif(Npoints), 51+runif(Npoints)), 
	data=data.frame(y1=c(NA, rnorm(Npoints-1)), 
	y2=c(sample(0:5, Npoints-1,replace=TRUE), NA)),
	proj4string=CRS(
	"+proj=longlat +datum=WGS84 +no_defs +ellps=WGS84 +towgs84=0,0,0"
	)
)

map.new(myPoints, legendRight=TRUE, mar=c(3,3,0,0), buffer=0.2)
points(myPoints)
legendBreaks('right', list(breaks=1:3, col=1:2))

Results