Skip to contents

Applies a geographic projection. Uses ggplot2::coord_sf() by default (for simple features), or ggplot2::coord_map() when a projection string is provided (requires mapproj).

Usage

project_map(
  plot,
  projection = NULL,
  xlim = NULL,
  ylim = NULL,
  clip = "on",
  ...
)

Arguments

plot

A plotit object.

projection

Map projection name (e.g. "mercator", "orthographic"). NULL uses coord_sf() default.

xlim, ylim

Longitude/latitude limits. NULL = auto.

clip

Should drawing be clipped? "on" or "off".

...

Passed to coord_sf() or coord_map().

Value

Modified plotit object.

Examples

if (FALSE) { # \dontrun{
# requires the sf package
nc <- sf::st_read(system.file("shape/nc.shp", package = "sf"), quiet = TRUE)
plotit(nc, encode()) |> project_map()
} # }