matchLabels: Match ggplot2 labels

View source: R/base-matchLabels.R

matchLabelsR Documentation

Match ggplot2 labels

Description

Allow user to define ggplot labels, and populate missing values from the defaults specified in labels formal argument.

Usage

matchLabels(labels, argName = "labels")

Arguments

labels

list. User-defined plot labels. Per element, supports character(1)., logical(1) (for automatic labels), or NULL.

argName

character(1). Argument name defined in formalArgs() to match against user input. Defaults to "labels".

Value

list. Returns an empty list on NULL input.

Note

Updated 2022-05-24.

See Also

  • ggplot2::labs().

Examples

fun <- function(
    object,
    labels = list(
        "title" = NULL,
        "x" = "x-axis",
        "y" = "y-axis"
    )) {
    labels <- matchLabels(labels)
    labels
}

acidgenomics/AcidPlots documentation built on March 29, 2024, 9:27 a.m.