auto.shading: auto.shading

View source: R/auto.shading.R

auto.shadingR Documentation

auto.shading

Description

Creates an object of class shading automatically, given a choropleth variable to be mapped.

Usage

auto.shading(x, digits = 2, cutter = quantileCuts, n = 5, 
	params = NA, cols = brewer.pal(n, "Reds"))

Arguments

x

The variable to be mapped.

digits

The number of significant digits to round the class limits to.

cutter

Function used to create the break points. Can be user defined or a supplied cut function.

n

The number of classes. The should be one more than the number of break points.

params

Other parameters to be passed to the cut function.

cols

List of colours for shading each class. length(cols) should be equal to n.

Details

Returns an object of class shading, as set out below:

Value

An object of class shading, having the following list elements:

breaks

Break points between choropleth classes. length(cols)

cols

Colours to shade in each class. length(cols) should be one more than length(breaks)

Author(s)

Chris Brunsdon, Binbin Lu

See Also

choropleth,shading,choro.legend.

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.