Learn R Programming

GISTools (version 0.7-4)

choropleth: choropleth

Description

Draws a choropleth map given a spatialPolygons object, a variable and a shading scheme.

Usage

choropleth(sp, v, shading = auto.shading(v), ...)

Arguments

sp
A spatialPolygons or spatialPolygonsDataFrame object.
v
The variaqble to be mapped. Must have the same number of elements as s has polygons.
shading
A shading scheme created by shading or auto.shading.
...
Additional parameters to be passed on to the plot method for sp.

Value

None (see above).

Details

The function returns no value, but draws a choropleth map on the current graphics device as a side effect.

See Also

choro.legend, auto.shading, shading.

Examples

Run this code
# Read in map data and compute a rate for mapping
sids <- readShapePoly(system.file("shapes/sids.shp", package="maptools")[1], 
	proj4string=CRS("+proj=longlat +ellps=clrk66"))
sids.rate=10000*sids$SID74/sids$BIR74
# Create the shading scheme,  plot a choropleth map 
shades = auto.shading(sids.rate,cols=brewer.pal(5,'Blues'))
choropleth(sids,sids.rate,shades)

Run the code above in your browser using DataLab