label_geochem: Geochem facet labelers

View source: R/ggstrat-labels.R

label_geochemR Documentation

Geochem facet labelers

Description

Geochem facet labelers

Usage

label_geochem(
  labels,
  units = character(0),
  default_units = NA_character_,
  geochem_facet = 1,
  renamers = c(`^d([0-9]+)([HCNOS])$` = "paste(delta ^ \\1, \\2)", `^210Pb$` =
    "paste({}^210, Pb)", `^Pb210$` = "paste({}^210, Pb)"),
  multi_line = TRUE
)

Arguments

labels

A data.frame of facet label values

units

A named list of values = unit

default_units

The default units to apply

geochem_facet

Which facet to apply formatting

renamers

Search and replace operations to perform in the form search = replace. Replace text can (should) contain backreferences, and will be parsed as an expression (see plotmath). Use NULL to suppress renaming.

multi_line

See label_parsed

Value

A ggplot2::labeller()

Examples


library(ggplot2)

ggplot(alta_lake_geochem, aes(x = value, y = depth)) +
  geom_lineh() +
  geom_point() +
  scale_y_reverse() +
  facet_wrap(
    vars(param),
    labeller = purrr::partial(label_geochem, geochem_facet = "param"),
    nrow = 1,
    scales = "free_x"
  ) +
  labs(x = NULL, y = "Depth (cm)")


paleolimbot/tidypaleo documentation built on Jan. 25, 2023, 2:43 a.m.