fortify.map: Fortify method for map objects

Description Usage Arguments See Also Examples

View source: R/fortify-map.r

Description

This function turns a map into a data frame that can more easily be plotted with ggplot2.

Usage

1
2
## S3 method for class 'map'
fortify(model, data, ...)

Arguments

model

map object

data

not used by this method

...

not used by this method

See Also

map_data() and borders()

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
if (require("maps")) {
ca <- map("county", "ca", plot = FALSE, fill = TRUE)
head(fortify(ca))
ggplot(ca, aes(long, lat)) +
  geom_polygon(aes(group = group))

tx <- map("county", "texas", plot = FALSE, fill = TRUE)
head(fortify(tx))
ggplot(tx, aes(long, lat)) +
  geom_polygon(aes(group = group), colour = "white")
}

hadley/ggplot2 documentation built on Aug. 13, 2018, 1:44 a.m.