Learn R Programming

psyosphere (version 0.1.6)

plot_polygon: Plot polygon on map

Description

Adds a polygon to an existing ggmap object.

Usage

plot_polygon(polygon, colour = "blue", plot = "", zoom = -1)

Arguments

polygon

list. A list with the column lon (numeric) and lat (numeric).

colour

character. Colour of the line.

plot

ggmap. An existing map / plot where the tracks are added. If no plot is provided a Google map will be downloaded.

zoom

numeric. Zoom factor of the map. See ggmap::get_googlemap.

Value

A ggmap object.

See Also

plot_map, plot_line, plot_tracks

Examples

Run this code
# NOT RUN {
\dontrun{
lon <- c(6.849975, 6.849627, 6.850001, 6.850350, 6.849975)
lat <- c(52.241745, 52.241100, 52.241004, 52.241649, 52.241745)
polygon <- data.frame(lon, lat)
remove(lon, lat)

plot <- plot_polygon(polygon)
plot
}
# }

Run the code above in your browser using DataLab