USALevelPlot {gmaps} | R Documentation |
USA Level Plot
Description
USALevelPlot produces a mapGrob object for a map of the United States where the .
Usage
USALevelPlot(
states,
levels,
col.fun=grey,
alaska='alaska'%in%tolower(states),
hawaii='hawaii'%in%tolower(states),
normalize=TRUE,
name=NULL,
vp=NULL,
gp=NULL,
asp=1.4,
...)
grid.USALevelPlot(...)
Arguments
states |
List of the full names of the states. |
levels |
The response variable to use to color code the states |
col.fun |
A color function that takes the response variable and returns a color code. |
alaska |
include an inset of alaska? |
hawaii |
include an inset of Hawaii? |
normalize |
Does the response variable need to be transformed to between 0 and 1. If False and levels is outside of [0,1] may cause errors depending on the col.fun. |
name |
the name of the object. |
vp |
Viewport for the object. used to embed within other objects. |
gp |
grid graphics parameters, ie. a gpar object. |
asp |
aspect ratio for the map. |
... |
other parameters passed on. |
See Also
Color Functions, mapGrob
, map
Examples
#maps of Arrests by state for arrests per 100,000 for Murder
data(USArrests)
attach(USArrests)
grid.newpage()
grid.frame(name="map")
grid.pack("map",USALevelPlot(states=rownames(USArrests),levels=Murder,col.fun=reds),height=unit(1,'null'))
grid.pack("map",gradientLegendGrob(at=quantile(Murder),col.fun=reds),side="bottom",height=unit(.2,'npc'))
detach(USArrests)
[Package
gmaps version 0.1
Index]