| Title: | Make 'ggplot2' Fully Accessible by Generating Alternative Text |
|---|---|
| Description: | Generates concise alternative text for data visualizations created with 'ggplot2'. Descriptions are produced by inspecting plot layers, labels, scales, and facets, with support for multiple languages and alternative text stored in plot metadata. |
| Authors: | Joseph Barbier [aut, cre, cph] |
| Maintainer: | Joseph Barbier <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 0.3.0 |
| Built: | 2026-06-25 17:21:37 UTC |
| Source: | https://github.com/cran/ggalttext |
Call this function once at the top of your Quarto document to include an alternative text for all of your ggplot2 charts.
enable_auto_alt_text(...)enable_auto_alt_text(...)
... |
Arguments passed to |
NULL, invisibly
generate_alt_text() takes any ggplot2 object and generates
a string that describes what contains the chart.
The description isn't meant to exactly describe the chart, nor how it was made. Instead, it tries to be short and gives an overview of what's inside the chart such as:
the kind of chart(s)
the number of chart(s) for facets
the title
...
The text can be generated in: English (default), French or German.
Learn more: https://www.section508.gov/create/alternative-text/
generate_alt_text( p, ..., lang = c("en", "fr", "de"), include_title = TRUE, max_chars = 125, error_on_excess = FALSE, source = c("default", "auto", "origin") )generate_alt_text( p, ..., lang = c("en", "fr", "de"), include_title = TRUE, max_chars = 125, error_on_excess = FALSE, source = c("default", "auto", "origin") )
p |
A |
... |
Must be empty. This argument requires all arguments after |
lang |
Language used for generated text. Defaults to |
include_title |
Whether to include the title of the plot, if any, in the alternative text. This is mostly useful to reduce the length of the text. |
max_chars |
The maximum number of characters allowed (default to 125 as
recommended by most references). If above, it will raise a warning. If
|
error_on_excess |
Whether to raise an error when the number of
characters of the alt text is above |
source |
Method used to select alt text. Since ggplot2 objects can
include built-in alt text (via |
A string