Install: remotes::install_github("mshin77/a11yviz")
ggplot2 transforms
Composable additions to a ggplot chain.
| Function | Description |
|---|---|
theme_a11y(level = "AA", base_family = "", dark = FALSE) |
Accessible ggplot2 theme |
scale_color_a11y(palette = "dark2_8", ...) |
Accessible discrete color and fill scales |
scale_fill_a11y(palette = "dark2_8", ...) |
Accessible discrete color and fill scales |
scale_color_a11y_div(palette = "rdbu", ...) |
Accessible diverging color and fill scales |
scale_fill_a11y_div(palette = "rdbu", ...) |
Accessible diverging color and fill scales |
scale_color_a11y_seq(palette = "cividis", ...) |
Accessible sequential continuous color and fill scales |
scale_fill_a11y_seq(palette = "cividis", ...) |
Accessible sequential continuous color and fill scales |
plotly transforms
Layout and styling for plotly figures.
| Function | Description |
|---|---|
a11y_layout(p, level = "AA", palette = "dark2_8") |
Apply accessible layout to a plotly figure |
a11y_ggplotly(gg, level = "AA", palette = NULL, alt = NULL, tooltip = c("x", "y"), strip_title = TRUE, ...) |
Convert ggplot to accessible plotly for supplemental online output |
Alt text
Attach, scaffold, or LLM-draft screen-reader descriptions.
| Function | Description |
|---|---|
a11y_alt_text(p, text) |
Add alt text to a plot |
a11y_alt_template(p) |
Generate a deterministic alt-text template for a plot |
a11y_describe(p, backend, attach = TRUE) |
Generate alt text via a user-supplied LLM backend |
Palettes
Discrete, diverging, and sequential palettes with WCAG metadata.
| Function | Description |
|---|---|
a11y_palette(name = "dark2_8", n = NULL, bg = NULL) |
Discrete color palette (categorical) |
a11y_palette_div(name = "rdbu") |
Diverging palette |
a11y_palette_seq(name = "cividis", n = NULL) |
Sequential continuous palette |
a11y_palette_info(name = "dark2_8") |
Discrete palette metadata |
a11y_palette_list(type = NULL) |
List available palettes |
a11y_show_palette(name = "dark2_8", bg = "#ffffff", level = "AA") |
Visualize a palette with WCAG contrast overlay |
Audits and checks
Multi-criterion figure audit, rubric, and single-aspect checks.
| Function | Description |
|---|---|
a11y_audit(p, level = "AA") |
Audit a plot against accessibility standards |
a11y_rubric(level = NULL) |
WCAG 2.1 rubric for the success criteria a11yviz addresses |
a11y_check_headings(path, min_chars = 3) |
Check Markdown / Quarto / HTML heading hierarchy and labels |
a11y_check_palette(colors, bg = "#ffffff", level = "AA", alpha = 1) |
Check a palette against WCAG contrast thresholds |
a11y_check_palette_size(n, max = 7) |
Flag categorical palettes above the recommended maximum |
a11y_check_readability(text) |
Estimate reading level of prose |
a11y_check_separability(colors, min_ratio = 3) |
Flag color pairs below the WCAG 2.1 Success Criterion 1.4.11 contrast threshold |
a11y_plotly_sequences(bg = "#ffffff", level = "AA") |
Audit plotly’s built-in discrete color sequences |
Wrappers and utilities
One-shot helpers and resource paths.
| Function | Description |
|---|---|
make_a11y(p, level = "AA", palette = "dark2_8", alt = NULL) |
One-shot accessibility wrapper |
a11y_alpha_presets() |
Alpha presets for chart layers |
a11y_text_spacing_ratios() |
WCAG 1.4.12 text-spacing ratios (reference data) |
a11y_css() |
Path to the accessible CSS |
a11y_wcag_url(criterion) |
WCAG 2.1 specification URL for a success criterion |