This function generates x and y axis titles based on the data columns
used to create the plot, looking up in a named list or yspec object. This
is only for pmplot outputs; consider pm_gg_labs() for labeling aesthetics
in an arbitrary gg object.
Arguments
- 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.- x
label for the x aesthetic; if
NULL, resolved via the mapped column name. Pass a column name as a plain string to look it up inspecorlabs; wrap inI()to use the string as a literal label.- y
label for the y aesthetic; see
x.- short_max
passed to
yspec::ys_get_short_unit()whenspecis ayspecobject.- x_break
character width at which to insert a single line break in the x axis label; 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.- y_break
character width at which to insert a single line break in the y axis label; see
x_break.- var_break
a named list or named numeric vector; names refer to variables in
specorlabs, and each value is passed as thewidthargument tostr_break()to insert a newline in that variable's label. Applied variable-by-variable before axis labels are resolved; keys absent fromspec/labsare silently ignored.- ...
additional arguments passed to
ggplot2::labs().
Examples
data <- pmplots_data_obs()
spec <- list(PRED = "Population predicted CX1123 (ng/mL)",
DV = "Observed CX1123 (ng/mL)")
if (FALSE) { # \dontrun{
p <- dv_pred(data) + pmp_gg_labs(spec)
p
} # }
