Skip to contents

Add maps of simple features into rows of a gt table with ggplot2. Function naming convention borrowed from gtExtras https://jthomasmock.github.io/gtExtras/reference/gt_img_rows.html

Usage

gt_geom_sf_rows(
  gt_object,
  mapping = NULL,
  fill = NA,
  color = "black",
  size = 1,
  linetype = "solid",
  height = 100,
  asp = 1,
  fn = NULL,
  ...
)

Arguments

gt_object

An existing gt table object of class gt_tbl. The gt_object must be convertible to an sf object with sf::st_as_sf so do not drop the geometry before creating an sf object.

mapping

aesthetic mapping passed to layer_location_data, Default: NULL

fill

Fill (used for polygon geometry), Default: NA

color

Color (used for polygon, point, and line geometry), Default: 'black'

size

Color (used for polygon, point, and line geometry), Default: 1

linetype

Color (used for polygon and line geometry), Default: 'solid'

height

The absolute height (px) of the map in the table cell

asp

The aspect ratio of the map in the table cell.

fn

Optional rowwise function that results in ggplot2 map the replaces geometry column.