map_data

0th

Percentile

Create a data frame of map data.

Create a data frame of map data.

Usage
map_data(map, region = ".", exact = FALSE, ...)
Arguments
map
name of map provided by the maps package. These include county, france, italy,
region
name of subregions to include. Defaults to . which includes all subregion. See documentation for map for more details.
exact
should the region be treated as a regular expression (FALSE) or as a fixed string (TRUE).
...
all other arguments passed on to map
Aliases
  • map_data
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")
}
Documentation reproduced from package ggplot2, version 0.9.3.1, License: GPL-2

Community examples

Looks like there are no examples yet.