choropleth: choropleth

View source: R/choropleth.R

choroplethR Documentation

choropleth

Description

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

Usage

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

Arguments

sp

A SpatialPolygonsDataFrame or sf -POLYGON or - MULTIPOLYGON object.

v

The variable name to be mapped and must included in the data.

shading

A shading scheme created by shading or auto.shading.

...

Additional parameters to be passed on to the plot method for sp.

Details

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

Value

None (see above).

Author(s)

Chris Brunsdon, Binbin Lu

See Also

choro.legend, auto.shading, shading.

Examples

# Read in map data and compute a rate for mapping
# Try the sf class
data(WHData)
shades = auto.shading(WHHP[["Avg_HP_avg"]],n=7)
dev.new(width = 16, height = 12)
choropleth(sp = WHHP,v="Avg_HP_avg",shading=shades)
choro.legend(548871.4, 3377000, shades,title='Average house price')
#Try the Spatial object
shades = auto.shading(whp_sp@data[["Avg_HP_avg"]],n=6)
dev.new(width = 16, height = 12)
choropleth(sp = whp_sp,v="Avg_HP_avg",shading=shades)
choro.legend(548871.4, 3377000,  shades,title='Average house price')

GISTools documentation built on Oct. 3, 2024, 1:08 a.m.