a11y_ggplot2_bar: Accessible bar chart

View source: R/plots.R

a11y_ggplot2_barR Documentation

Accessible bar chart

Description

A minimal wrapper for a simple bar chart with accessibility features using ggplot2::ggplot2. Provides a high-contrast color palette, black bar outlines, and a minimal theme by default.

Usage

a11y_ggplot2_bar(
  data,
  x,
  y,
  accessible_colors = NULL,
  border_color = "#000000",
  bar_width = 0.9,
  legend_title = NULL,
  ...
)

Arguments

data

Data frame

x

Column name for categories (unquoted)

y

Column name for bar heights (unquoted)

accessible_colors

(optional) Character vector of colors for the palette

border_color

(optional) Color for bar outlines (default: "#000000")

bar_width

(optional) Bar width (default: 0.9)

legend_title

(optional) Title for the legend (default: NULL)

...

Additional arguments passed to ggplot2::labs() (e.g. title, axis labels)

Value

A ggplot2::ggplot() object

Examples

df <- data.frame(
  category = c("Alpha", "Beta", "Gamma"),
  count    = c(23, 17, 31)
)
a11y_ggplot2_bar(
  data = df, x = category, y = count,
  title = "Counts by Category"
)


a11yShiny documentation built on April 1, 2026, 5:07 p.m.