A helper function that converts strings to glue strings for the title, subtitle, and caption.
Usage
labs_ext(
...,
title = ggplot2::waiver(),
subtitle = ggplot2::waiver(),
caption = ggplot2::waiver(),
tag = ggplot2::waiver(),
alt = ggplot2::waiver(),
alt_insight = ggplot2::waiver(),
source_note = NULL,
source_sep = ". ",
source_before = "Source: ",
source_end = ".",
.sep = "",
.envir = parent.frame(),
.open = "{",
.close = "}",
.na = "NA",
.null = character(),
.comment = "#",
.literal = FALSE,
.transformer = glue::identity_transformer,
.trim = TRUE
)Arguments
- ...
Arguments passed on to
ggplot2::labsalt,alt_insightText used for the generation of alt-text for the plot. See get_alt_text for examples.
- title
The text for the title.
- subtitle
The text for the subtitle for the plot which will be displayed below the title.
- caption
The text for the caption which will be displayed in the bottom-right of the plot by default.
- tag
The text for the tag label which will be displayed at the top-left of the plot by default.
- alt, alt_insight
Text used for the generation of alt-text for the plot. See get_alt_text for examples.
- source_note
Data source(s) to append to caption or use as caption (if no caption is supplied). Also supports glue string interpolation.
- source_sep, source_before, source_end
Strings used to separate caption (if supplied) and source note, add before the source note, and add after the source note.
- .sep
[
character(1): ‘""’]
Separator used to separate elements.- .envir
[
environment:parent.frame()]
Environment to evaluate each expression in. Expressions are evaluated from left to right. If.xis an environment, the expressions are evaluated in that environment and.enviris ignored. IfNULLis passed, it is equivalent toemptyenv().- .open
[
character(1): ‘\{’]
The opening delimiter. Doubling the full delimiter escapes it.- .close
[
character(1): ‘\}’]
The closing delimiter. Doubling the full delimiter escapes it.- .na
[
character(1): ‘NA’]
Value to replaceNAvalues with. IfNULLmissing values are propagated, that is anNAresult will causeNAoutput. Otherwise the value is replaced by the value of.na.- .null
[
character(1): ‘character()’]
Value to replace NULL values with. Ifcharacter()whole output ischaracter(). IfNULLall NULL values are dropped (as inpaste0()). Otherwise the value is replaced by the value of.null.- .comment
[
character(1): ‘#’]
Value to use as the comment character.- .literal
[
boolean(1): ‘FALSE’]
Whether to treat single or double quotes, backticks, and comments as regular characters (vs. as syntactic elements), when parsing the expression string. Setting.literal = TRUEprobably only makes sense in combination with a custom.transformer, as is the case withglue_col(). Regard this argument (especially, its name) as experimental.- .transformer
[
function]
A function taking two arguments,textandenvir, wheretextis the unparsed string inside the glue block andenviris the execution environment. A.transformerlets you modify a glue block before, during, or after evaluation, allowing you to create your own customglue()-like functions. Seevignette("transformers")for examples.- .trim
[
logical(1): ‘TRUE’]
Whether to trim the input template withtrim()or not.
