Skip to contents

Provides support for well-formatted titles and footer text with minimal user adjustment needed.

Usage

labs_e61(
  title = NULL,
  subtitle = NULL,
  footnotes = NULL,
  sources = NULL,
  title_wrap = NULL,
  subtitle_wrap = NULL,
  footnote_wrap = NULL,
  x = NULL,
  y = ggplot2::waiver(),
  title_max_char = NULL,
  subtitle_max_char = NULL,
  footnote_max_char = NULL,
  ...
)

Arguments

title

The text for the title.

subtitle

The text for the subtitle.

footnotes

A vector of footnote text strings. Each new string will be prepended with *, **, ***, etc. Note you'll need to include the asterisks in the title/subtitle yourself. Please be sensible with the number of separate points you include in the graph.

sources

String vector providing the names of sources for the graph.

title_wrap, subtitle_wrap, footnote_wrap

Numeric or logical. Set the maximum number of characters per line in the title, subtitle and footer text. Set to FALSE if you want to turn off text wrapping. The default is usually appropriate for the default graph dimensions in save_e61.

x, y

String to set the x- and y-axis titles. Note that the x-axis title is blank (NULL) by default.

title_max_char, subtitle_max_char, footnote_max_char

[Deprecated] No longer supported; use title_wrap, subtitle_wrap or footnote_wrap instead.

...

Additional optional arguments passed to labs.

Details

You should use vectors in the footnotes and sources to take advantage of the formatting features of this function.

The arguments in the function allow you to make changes to the text formatting if required.

The primary purpose of this function is to correctly format footer text without requiring the user to guess where to put manual line breaks for long footnotes or put in "Sources:" themselves. It does this by transforming the footnotes and sources arguments into nicely formatted text that goes into the caption argument in ggplot2's labs() function. Thus, if you are using footnotes or sources, do not supply a caption argument as well.

Examples

  ggplot() +
  theme_e61() +
  labs_e61(
    title = "Graph title*",
    subtitle = "Graph subtitle**",
    sources = c("A source", "Company name", "Better source"),
    footnotes = c("Footnote 1", "Footnote 2")
    )