Getting Started with MAIDR

JooYoung Seo

2026-07-09

Introduction to MAIDR

MAIDR (Multimodal Access and Interactive Data Representation) is an R package that makes data visualizations accessible to users with visual impairments. It converts ggplot2 and Base R plots into interactive, accessible formats with:

MAIDR helps data scientists and researchers create inclusive visualizations that everyone can explore, regardless of visual ability.

Installation

Install the development version from GitHub:

# Install the released version from CRAN
install.packages("maidr")

# Or the development version from GitHub:
# install.packages("devtools")
devtools::install_github("xability/r-maidr")

Basic Workflow

MAIDR works with two main functions:

  1. show() - Display an interactive plot in RStudio Viewer or browser
  2. save_html() - Save a plot as a standalone HTML file

Quick Example: ggplot2 Bar Chart

library(maidr)
library(ggplot2)

# Create sample data
sales_data <- data.frame(
  Product = c("A", "B", "C", "D"),
  Sales = c(150, 230, 180, 290)
)

# Create a bar chart
p <- ggplot(sales_data, aes(x = Product, y = Sales)) +
  geom_bar(stat = "identity", fill = "steelblue") +
  labs(
    title = "Product Sales by Category",
    x = "Product",
    y = "Sales Amount"
  ) +
  theme_minimal()

# Display interactively
show(p)

# Or save as HTML file
save_html(p, "sales_chart.html")

Quick Example: Base R Plot

MAIDR also works with Base R plotting functions:

library(maidr)

# Create a simple barplot
categories <- c("A", "B", "C", "D")
values <- c(150, 230, 180, 290)

barplot(
  values,
  names.arg = categories,
  col = "steelblue",
  main = "Product Sales by Category",
  xlab = "Product",
  ylab = "Sales Amount"
)

# Note: For Base R plots, call show() with NO arguments
# after creating the plot
show()

Offline vs CDN Usage

By default, MAIDR auto-detects internet availability and loads the MAIDR.js library from a CDN when online. You can control this behavior with the use_cdn parameter:

library(maidr)
library(ggplot2)

p <- ggplot(mtcars, aes(x = factor(cyl), y = mpg)) +
  geom_bar(stat = "identity")

# Auto-detect (default) - uses CDN if internet available
show(p)

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

# Force bundled/local files (works offline)
show(p, use_cdn = FALSE)

The same parameter works with save_html():

# Save with CDN links (smaller file, needs internet to view)
save_html(p, "plot_cdn.html", use_cdn = TRUE)

# Save with bundled files (larger file, works offline)
save_html(p, "plot_offline.html", use_cdn = FALSE)

When to use use_cdn = FALSE: - Creating portable HTML files for offline viewing - Sharing files with users who may not have internet access - Ensuring reproducibility with a specific MAIDR.js version

Exploring Accessible Plots

When you open a MAIDR plot, you can explore it using:

Keyboard Navigation

Screen Reader Announcements

MAIDR plots include:

Data Sonification

Plots can be heard through:

Supported Plot Types

MAIDR supports a comprehensive range of visualizations:

Basic Plot Types

See the Examples article for the full candlestick + MA + volume pipeline and the Base R support matrix.

Advanced Plot Types

Next Steps

Tips for Creating Accessible Plots

  1. Use clear titles - Describe what the plot shows
  2. Label axes properly - Include units of measurement
  3. Choose distinct colors - Ensure good contrast
  4. Add legends - Explain what colors/shapes mean
  5. Keep it simple - Avoid overcrowded visualizations

Getting Help

Learn More