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.
Usage
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()orpairs_plot().- spec
a named list of label data; names correspond to columns in the data used to make the plot; may also be a
yspecobject, which will be converted to a named list throughyspec::ys_get_short_unit().- labs
another object like
speccontaining of label data to override names found inspec.- short_max
passed to
yspec::ys_get_short_unit()whenspecis ayspecobject.- 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.
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'
