map_data {ggplot2}R Documentation

Map data

Description

Convert map to data frame

Usage

map_data(map, region = ".")

Arguments

map map name
region region name

Author(s)

Hadley Wickham <h.wickham@gmail.com>

Examples

if (require(maps)) {
states <- map_data("state")
arrests <- USArrests
names(arrests) <- tolower(names(arrests))
arrests$region <- tolower(rownames(USArrests))

choro <- merge(states, arrests, sort = FALSE, by = "region")
choro <- choro[order(choro$order), ]
qplot(long, lat, data = choro, group = group, fill = assault,
geom="polygon")
qplot(long, lat, data = choro, group = group, fill = assault / murder,
geom="polygon")
}

[Package ggplot2 version 0.8.2 Index]