Description Usage Arguments Details Value Author(s) See Also Examples
Creates an object of class shading
automatically, given a choropleth variable to be mapped.
1 2 | auto.shading(x, digits = 2, cutter = quantileCuts, n = 5,
params = NA, cols = brewer.pal(n, "Reds"))
|
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. |
Returns an object of class shading
, as set out below:
An object of class shading
, having the following list elements:
breaks |
Break points between choropleth classes. |
cols |
Colours to shade in each class. |
Chris Brunsdon
choropleth
,shading
,choro.legend
.
1 2 3 4 5 6 7 8 9 10 11 12 | # 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 and add a legend
shades = auto.shading(sids.rate,n=6)
choropleth(sids,sids.rate,shades)
choro.legend(-83.77,37.87,shades,fmt="%4.1f",title='Rate per 10,000')
# Now again with a different set of class intervals and colours
shades = auto.shading(sids.rate,n=6,cutter=rangeCuts,cols=brewer.pal(6,'Greens'))
choropleth(sids,sids.rate,shades)
choro.legend(-83.77,37.87,shades,fmt="%4.1f",title='Rate per 10,000')
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.