Description Usage Arguments Details Value Author(s) See Also Examples
Draw a legend for a choropleth map.
1 2 | choro.legend(px, py, sh, under = "under", over = "over",
between = "to", fmt = "%g", cex=1, ...)
|
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 |
Returns no value, but draws a choropleth map legend on the current graphics device as a side effect
None (see above)
Chris Brunsdon
choropleth
, auto.shading
, shading
.
1 2 3 4 5 6 7 8 | # 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@data[,10]/sids@data[,9]
# Create the shading scheme, plot a choropleth map and add a legend
shades = auto.shading(sids.rate)
choropleth(sids,sids.rate,shades)
choro.legend(-83.77,37.87,shades,fmt="%4.1f",cex=0.8,title='Rate per 10,000')
|
Loading required package: maptools
Loading required package: sp
Checking rgeos availability: TRUE
Loading required package: RColorBrewer
Loading required package: MASS
Loading required package: rgeos
rgeos version: 0.3-23, (SVN revision 546)
GEOS runtime version: 3.4.2-CAPI-1.8.2 r3921
Linking to sp version: 1.2-3
Polygon checking: TRUE
NOTE: rgdal::checkCRSArgs: no proj_defs.dat in PROJ.4 shared files
Warning message:
use rgdal::readOGR or sf::st_read
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.