lifted from choropleth in the USCensus2000 package

Share:

Description

produces a choropleth plot for a SpatialPolygonsDataFrame

Usage

1
2
3
spatialChoropleth(sp, color ,quantileBin=FALSE, palette, alpha=1,
		main = NULL, sub = "", legend.loc = "bottomleft", 
		legend.title ,add=TRUE,border="transparent", ...) 

Arguments

sp

a SpatialPolygonsDataFrame

color

the variable to map to color (either the name in x or a vector)

quantileBin

should color be devided into quantile bins. If true, 5 bins are useds. alternatively quantileBin can be set to the number of desired bins

palette

A color scale (See the scales package)

alpha

transparency

main

title

sub

subtitle

legend.loc

legend location

legend.title

title

add

add to current plot

border

polygon border type

...

additional parameters for plot

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
## Not run: 
library(UScensus2000)

lat <- c(43.834526782236814,30.334953881988564)
lon <- c(-131.0888671875  ,-107.8857421875)
southwest <- openmap(c(lat[1],lon[1]),c(lat[2],lon[2]),5,'bing')
data(california.tract)
california.tract <- spTransform(california.tract,osm())

plot(southwest,removeMargin=TRUE)
spatialChoropleth(california.tract,'med.age',
		legend.title = 'Median Age',alpha=1)

## End(Not run)