Skip to contents

Adds a geographic map layer for sf spatial data frames. Requires the sf package.

Usage

mark_map(
  plot,
  mapping = NULL,
  data = NULL,
  position = NULL,
  ...,
  rasterize = FALSE,
  rasterize_dpi = 300,
  rasterize_dev = "cairo"
)

Arguments

plot

A plotit object

mapping

Optional new aesthetics

data

Optional sf data frame for this layer

position

Position adjustment (ignored for sf layers).

...

Other arguments passed to geom_sf

rasterize

If TRUE, rasterize via ggrastr::rasterise().

rasterize_dpi

DPI for rasterization (default 300).

rasterize_dev

Graphics device for rasterization (default "cairo").

Value

Modified plotit object

References

Vega-Lite: Geoshape

AntV G2: GeoPath

Examples

if (requireNamespace("sf", quietly = TRUE)) {
  nc <- sf::st_read(system.file("shape/nc.shp", package = "sf"), quiet = TRUE)
  plotit(nc, encode(geometry = geometry)) |> mark_map()
}