maidr

July 10, 2026 · View on GitHub

R-CMD-check Lifecycle: experimental

Overview

maidr (Multimodal Access and Interactive Data Representation) makes data visualizations accessible to users with visual impairments. It converts ggplot2 and Base R plots into interactive, accessible HTML/SVG formats with keyboard navigation, screen reader support, and sonification.

The package provides two main functions:

  • show() displays an interactive accessible plot in RStudio Viewer or browser
  • save_html() exports a plot as a standalone HTML file

Installation

Install the stable release from CRAN:

install.packages("maidr")

Or install the development version from GitHub:

# Using pak (recommended)
pak::pak("xability/r-maidr")

# Alternative: using pacman (auto-installs if missing)
pacman::p_load_gh("xability/r-maidr")

Usage

ggplot2

library(maidr)
library(ggplot2)

p <- ggplot(mpg, aes(x = class)) +
  geom_bar(fill = "steelblue") +
  labs(title = "Vehicle Classes", x = "Class", y = "Count")

# Display interactive accessible plot
show(p)

# Or save to file
save_html(p, "vehicle_classes.html")

Base R

library(maidr)

# Create plot first
barplot(
  table(mtcars$cyl),
  main = "Cars by Cylinder Count",
  xlab = "Cylinders",
  ylab = "Count"
)

# Then call show() without arguments
show()

Supported plot types

maidr supports a wide range of visualization types in both ggplot2 and Base R:

Basic Plot Types

Plot Typeggplot2Base R
Bar chartsgeom_bar(), geom_col()barplot()
Grouped/Dodged barsposition = "dodge"beside = TRUE
Stacked barsposition = "stack"beside = FALSE
Histogramsgeom_histogram()hist()
Scatter plotsgeom_point()plot()
Line plotsgeom_line()plot(type = "l"), lines()
Box plotsgeom_boxplot()boxplot()
Heatmapsgeom_tile()image()
Violin plotsgeom_violin()
Candlestick (OHLC)tidyquant::geom_candlestick() (+ geom_ma(), + patchwork volume)quantmod::chartSeries() (OHLC-only; no TA / no volume)
Density/Smoothgeom_smooth(), geom_density()lines(density())

Note: Volume bars and moving-average overlays for candlestick charts are supported only on the ggplot2 + {tidyquant} + {patchwork} path. On the Base R path, quantmod::chartSeries() TA overlays (addVo(), addSMA(), addEMA()) — and the default TA whenever the input xts carries a Volume column — fall back to native (non-accessible) graphics with a one-time advisory.

Advanced Plot Types

Plot Typeggplot2Base R
Faceted plotsfacet_wrap(), facet_grid()par(mfrow/mfcol) + loops
Multi-panel layoutspatchwork packagepar(mfrow), par(mfcol)
Multi-layered plotsMultiple geom_* layersSequential plot calls

See vignette("plot-types") for detailed examples of each plot type.

Accessibility features

  • Keyboard navigation - explore data points using arrow keys
  • Screen reader support - full ARIA labels and live announcements
  • Sonification - hear data patterns through sound
  • Text descriptions - automatic statistical summaries

Offline support

By default, maidr auto-detects internet availability and loads the MAIDR.js library from a CDN. Use the use_cdn parameter for explicit control:

# Force CDN (requires internet)
show(p, use_cdn = TRUE)

# Force bundled files (works offline)
show(p, use_cdn = FALSE)
save_html(p, "plot.html", use_cdn = FALSE)

Getting help

Learning more

  • vignette("getting-started", package = "maidr") for an introduction
  • vignette("plot-types", package = "maidr") for supported visualizations
  • vignette("shiny-integration", package = "maidr") for Shiny apps