geom_organs: Add organs map to your 'humap'

Description Usage Arguments Details Value

View source: R/geom_organs.R

Description

Use this function to draw a choropleth on the internal organs of a human. The bridge_loc, combine and controls arguments behave as for geom_body, so go to its Details section for more on how to use these.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
geom_organs(
  mapping = NULL,
  data = NULL,
  annotate = "freq",
  bridge_loc = NULL,
  combine = NULL,
  controls = NULL,
  na.rm = FALSE,
  show.legend = FALSE,
  inherit.aes = TRUE,
  ...
)

Arguments

mapping

aes() object, just like other ggplot2 functions, with two 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, but see bridge_side). It is possible to supply a fill argument to use pre-computed summary statistics (see below).

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.

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.

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.

Details

The polygons in this geom overlap, so you can give them outlines with colour and size (just as you do for, i.a., histogram and ribbon geoms) to make them easier to distinguish. By default, there is no outline.

Value

A layer object to a humap object.


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