annotation_map

0th

Percentile

Annotation: a maps

Display a fixed map on a plot.

Usage
annotation_map(map, ...)
Arguments
map

data frame representing a map. Most map objects can be converted into the right format by using fortify()

...

other arguments used to modify aesthetics

Aliases
  • annotation_map
Examples
# NOT RUN {
if (require("maps")) {
usamap <- map_data("state")

seal.sub <- subset(seals, long > -130 & lat < 45 & lat > 40)
ggplot(seal.sub, aes(x = long, y = lat)) +
  annotation_map(usamap, fill = "NA", colour = "grey50") +
  geom_segment(aes(xend = long + delta_long, yend = lat + delta_lat))

seal2 <- transform(seal.sub,
  latr = cut(lat, 2),
  longr = cut(long, 2))

ggplot(seal2,  aes(x = long, y = lat)) +
  annotation_map(usamap, fill = "NA", colour = "grey50") +
  geom_segment(aes(xend = long + delta_long, yend = lat + delta_lat)) +
  facet_grid(latr ~ longr, scales = "free", space = "free")
}
# }
Documentation reproduced from package ggplot2, version 3.1.0, License: GPL-2 | file LICENSE

Community examples

Looks like there are no examples yet.