This function adds candidate axis titles as an attribute on columns in data. This attribute is intended to be specifically used for pmplot axis labels, not to be confused with the label added by yspec::ys_add_labels().

pm_label_columns(df, spec, labs = list(), short_max = Inf)

Arguments

df

a data frame to label.

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.

Value

The data frame df with pmp.axis.label attributes set on the labeled columns. If no columns in spec or labs match column names in df, a warning is issued and df is returned unchanged.

See also