Label ggplot2 plots with the appropriate credit caption for NHGIS data
Source:R/labs_nhgis.R
labs_nhgis.Rdlabs_nhgis() adds a standard credit caption for NHGIS data to make consistent attribution easier.
Usage
labs_nhgis(
...,
caption = NULL,
credit = "IPUMS NHGIS, University of Minnesota, www.nhgis.org.",
prefix = "Source: ",
collapse = " ",
width = 80
)Arguments
- ...
Arguments passed on to
ggplot2::labstitleThe text for the title.
subtitleThe text for the subtitle for the plot which will be displayed below the title.
tagThe text for the tag label which will be displayed at the top-left of the plot by default.
dictionaryA named character vector to serve as dictionary. Automatically derived labels, such as those based on variables will be matched with
names(dictionary)and replaced by the matching entry indictionary.alt,alt_insightText used for the generation of alt-text for the plot. See get_alt_text for examples.
altcan also be a function that takes the plot as input and returns text as output.altalso accepts rlang lambda function notation.
- caption
Optional text appearing before IPUMS credit text.
- credit
Credit line for IPUMS.
- prefix
Prefix text appearing before
credittext.- collapse
String to collapse
captionandcredit. Defaults to" ". Set to"\n"to place the credit line on a separate line following the caption. Ignored if caption isNULL.- width
Maximum width of caption line passed to
stringr::str_wrap().