View source: R/annotation-borders.R
annotation_borders | R Documentation |
This is a quick and dirty way to get map data (from the maps package) onto your plot. This is a good place to start if you need some crude reference lines, but you'll typically want something more sophisticated for communication graphics.
annotation_borders(
database = "world",
regions = ".",
fill = NA,
colour = "grey50",
xlim = NULL,
ylim = NULL,
...
)
borders(...) # Deprecated
database |
map data, see |
regions |
map region |
fill |
fill colour |
colour |
border colour |
xlim , ylim |
latitudinal and longitudinal ranges for extracting map
polygons, see |
... |
Arguments passed on to
|
if (require("maps")) {
data(us.cities)
capitals <- subset(us.cities, capital == 2)
ggplot(capitals, aes(long, lat)) +
annotation_borders("state") +
geom_point(aes(size = pop)) +
scale_size_area() +
coord_quickmap()
}
if (require("maps")) {
# Same map, with some world context
ggplot(capitals, aes(long, lat)) +
annotation_borders("world", xlim = c(-130, -60), ylim = c(20, 50)) +
geom_point(aes(size = pop)) +
scale_size_area() +
coord_quickmap()
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.