geom_ais: geom_ais builds a body map using AIS coding directly

Description Usage Arguments Value

View source: R/geom_ais.R

Description

Use this function to draw a choropleth on a human body map. Use the arguments to choose exactly what kind of map you want. If you don't supply a body_halves argument humapr will default to pool mode. geom_ais is a variant of geom_body, so for see the details of that function for more information.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
geom_ais(
  mapping = NULL,
  data = NULL,
  type = "simple",
  with_back = TRUE,
  body_halves = NULL,
  annotate = "freq",
  bridge_loc = NULL,
  bridge_side = NULL,
  combine = NULL,
  controls = NULL,
  na.rm = FALSE,
  show.legend = FALSE,
  inherit.aes = TRUE,
  ...
)

Arguments

mapping

supply an aes() object, just like other ggplot2 functions. humapr::geom_* can take to aesthetics: loc is the name of the data frame column containing localisation codes for observations; and side the column holding the laterality data (must be either "left" or "right, although see bridge_side).

data

data frame, like the type you'd feed into ggplot() when producing a histogram. Is expected to be tidy, but can contain a summary statistic; in that case, you must specify a fill aesthetic and set stat = "identity" in the call to the geom.

type

currently, only "simple" is available, but we're working on more natural-looking and sex-specific maps as well.

with_back

logical, should the plot include the back-side of the head, neck and trunk?

body_halves

character string defining how to deal with body halves. "separate" (default with side aesthetic) discriminates the left half from the right; "join" (default without side aesthetic) merges observations in, e.g., right and left side of the chest.

annotate

"freq" (defaults) shows only absolute and relative frequencies, "all" includes region names, and NA omits labels altogether. See Details for ways to fine-tune the apperance of annotations.

bridge_loc

named list specifying the bridge from your data format to the native format of geom_body, e.g., list(head = c("head", "face", "scalp")). See Details.

bridge_side

named list, specyfing the bridge from your laterality values for each of the native values of geom_body, e.g. list(left = c("left", "l"), right = c("right", "r"), mid = c("mid", "m")). The mid element is only required if mid-line observation are included, see the controls argument.

combine

named list of vectors naming the regions to be combined and mapped as one, e.g., list(arm = c("shoulder", "arm", "elbow", "wrist")). See Details for behaviour.

controls

named list of more specific parameters for fine-tuning the appereance of the humap. Currently, these controls are available (more will follow in the future):

  • na_fill: should be a string or function specifying the fill of zero-count regions (default: "black")

  • label_pad: a numeric defining the padding between labels, in percent of map height (default: 3.5)

  • mid_include: a logical defining whether to include mid-line observations and split them equally between left and right (default: FALSE)

  • round_counts: a logical indicating whether to round (up) half-counts in annotation labels when splitting mid-line observations between left and right (default: FALSE)

na.rm

logical indicating whether to remove missing data. Default is FALSE.

show.legend

passed on to the underlying machinery of the geom.

inherit.aes

passed on to the underlying machinery of the geom.

...

passed on to the underlying machinery of the geom.

Value

A layer object to a humap object.


benskov/humapr documentation built on April 3, 2021, 6:52 a.m.