Learn R Programming

GISTools (version 1.0-1)

choro.legend: choro.legend

Description

Draw a legend for a choropleth map.

Usage

choro.legend(px, py, sh, under = "under", over = "over", 
  between = "to", fmt = "%g", cex=1, ...)

Value

None (see above)

Arguments

px

x coordinate of legend location

py

y coordinate of legend location

sh

Shading scheme object used as basis for the legend

under

What to write in front of the lowest choropleth class upper limit.

over

What to write in front of the highest choropleth class lower limit.

between

What to write between the upper and lower limits of intermediate chropleth classes.

fmt

C style format for values stated in above choroplth class limits.

cex

Relative size of text in the legend.

...

Other arguments, passed on to the generic legend function.

Author

Chris Brunsdon

Details

Returns no value, but draws a choropleth map legend on the current graphics device as a side effect

See Also

choropleth, auto.shading, shading.

Examples

Run this code
# 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')

Run the code above in your browser using DataLab