This function relabels the axis strip labels in a pairs plot created by eta_pairs() or pairs_plot() by looking up the variable names in a named list or yspec object. Variable names are discovered automatically from the plot object. Names absent from spec and labs are left unchanged.

pmp_relabel_pairs(
  p,
  spec,
  labs = list(),
  short_max = Inf,
  f_break = Inf,
  unit_break = TRUE,
  ...
)

Arguments

p

a pairs plot object created by eta_pairs() or pairs_plot().

spec

a named list of label data; names correspond to columns in the data used to make the plot; may also be a yspec object, which will be converted to a named list through yspec::ys_get_short_unit().

labs

another object like spec containing of label data to override names found in spec.

short_max

passed to yspec::ys_get_short_unit() when spec is a yspec object.

f_break

character width at which to insert a single line break in facet strip labels; defaults to Inf (no break); when the resolved label exceeds this width, a single newline is inserted at the last word boundary at or before the limit.

unit_break

if TRUE (the default), a newline is inserted between the label text and a trailing parenthetical unit (e.g., "Weight (kg)" becomes "Weight\n(kg)").

...

currently not used.

Value

The pairs plot p with updated facet labels.

Examples

id <- pmplots_data_id()

etas <- c("ETA1//ETA-CL", "ETA2//ETA-VC", "ETA3//ETA-KA")

spec <- list(ETA1 = "ETA on CL (L/h)", ETA2 = "ETA on Vc (L)")

p <- eta_pairs(id, etas)

pmp_relabel_pairs(p, spec)
#> `geom_smooth()` using formula = 'y ~ x'
#> `geom_smooth()` using formula = 'y ~ x'
#> `geom_smooth()` using formula = 'y ~ x'