Learn R Programming

maidr

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 from CRAN (coming soon)
install.packages("maidr")

# Or install development version from GitHub
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()
Density/Smoothgeom_smooth(), geom_density()lines(density())

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

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

Copy Link

Version

Install

install.packages('maidr')

Version

0.1.2

License

GPL (>= 3)

Issues

Pull Requests

Stars

Forks

Maintainer

Niranjan Kalaiselvan

Last Published

February 23rd, 2026

Functions in maidr (0.1.2)

BaseRHeatmapLayerProcessor

Base R Heatmap Layer Processor
BaseRAdapter

Base R System Adapter
BaseRBarplotLayerProcessor

Base R Bar Plot Layer Processor
BaseRDodgedBarLayerProcessor

Base R Dodged Bar Layer Processor
BaseRPointLayerProcessor

Base R Point/Scatter Plot Layer Processor
BaseRBoxplotLayerProcessor

Base R Boxplot Layer Processor
BaseRHistogramLayerProcessor

Base R Histogram Layer Processor
BaseRPatcher

Base R Patch Architecture
BaseRPlotOrchestrator

Base R Plot Orchestrator Class
BaseRLineLayerProcessor

Base R Line Plot Layer Processor
Ggplot2BarLayerProcessor

Bar Layer Processor
Ggplot2Adapter

ggplot2 System Adapter
BaseRStackedBarLayerProcessor

Base R Stacked Bar Layer Processor
Ggplot2DodgedBarLayerProcessor

Dodged Bar Layer Processor
Ggplot2HeatmapLayerProcessor

Heatmap Layer Processor
BaseRSmoothLayerProcessor

Base R Smooth/Density Layer Processor
Ggplot2HistogramLayerProcessor

Histogram Layer Processor
BaseRProcessorFactory

Base R Processor Factory
Ggplot2BoxplotLayerProcessor

Boxplot Layer Processor
BaseRUnknownLayerProcessor

Base R Unknown Layer Processor
MAIDR_VERSION

MAIDR JavaScript library version bundled with this package
Ggplot2SmoothLayerProcessor

Smooth Layer Processor
Ggplot2LineLayerProcessor

Final Line Layer Processor - Uses Actual SVG Structure
Ggplot2PointLayerProcessor

Point Layer Processor
Ggplot2UnknownLayerProcessor

Unknown Layer Processor
Ggplot2StackedBarProcessor

Stacked Bar Layer Processor
apply_barplot_sorting

Apply sorting logic to barplot arguments for consistent visual ordering
LayerProcessor

Abstract Layer Processor Interface
accuracy_to_decimals

Convert Accuracy to Decimal Places
add_maidr_data_to_svg

Add maidr-data to SVG using proper XML manipulation
Ggplot2ProcessorFactory

ggplot2 Processor Factory
ProcessorFactory

Processor Factory Base Class
Ggplot2PlotOrchestrator

Plot Orchestrator Class
PlotSystemRegistry

Plot System Registry
clean_maidr_args

Clean MAIDR internal arguments from args list
clear_plot_calls

Clear recorded plot calls
apply_barplot_patches

Apply modular patches to barplot arguments
classify_function

Classify a Base R Function
clear_all_device_storage

Clear All Device Storage
apply_scale_mapping

Apply scale mapping to convert numeric positions to category labels
close_maidr_temp_device

Close and clean up the MAIDR temp device
SystemAdapter

System Adapter Base Class
clear_device_storage

Clear Device Storage
combine_facet_layer_data

Combine data from multiple layers in facet processing
combine_facet_layer_selectors

Combine selectors from multiple layers in facet processing
create_inline_image

Create inline image HTML for non-iframe rendering
create_enhanced_svg

Create enhanced SVG with maidr data
create_fallback_html

Create Fallback HTML Content
build_format_config

Build Format Config from Detected Type and Parameters
.maidr_base_r_session

Base R Device-Scoped Storage
create_axis_wrapper

Create enhanced wrapper for axis to capture scales:: format config
create_fallback_iframe

Create iframe HTML tag for fallback static image
create_maidr_iframe

Create iframe HTML tag for isolated MAIDR plot
create_standalone_html

Create self-contained HTML for iframe embedding
create_html_document

Create HTML document with dependencies
create_maidr_html

Create HTML document with maidr enhancements using the orchestrator
create_function_wrapper

Create a function wrapper
detect_panel_configuration

Detect Multi-panel Configuration
create_barplot_wrapper

Create enhanced wrapper for barplot with sorting logic
.maidr_patching_env

Base R Function Patching System
create_fallback_image

Create Fallback Image for Unsupported Plots
detect_scales_format_type

Detect Format Type from scales Closure Parameters
display_html

Display HTML document directly
generate_robust_css_selector

Generate robust CSS selector from grob name
ensure_maidr_device

Ensure a device is open before plotting (suppress default window)
format-utils

Format Extraction Utilities
create_maidr_widget_internal

Create MAIDR Widget for knitr (Internal)
extract_axis_format

Extract Format Configuration for a Single Axis
extract_patchwork_leaves

Recursively extract leaf ggplots in visual order
extract_leaf_plot_layout

Extract layout from a single leaf ggplot
extract_format_config

Extract Format Configuration from Built Plot
find_panel_grob

Find the panel grob in a grob tree
get_device_calls

Get Plot Calls from Device Storage
find_children_by_type

Find children matching a type pattern
find_patchwork_panels

Discover panels via gtable layout rows named '^panel-<num>' or '^panel-<row>-<col>' Returns a data.frame with panel_index, name, t, l, row, col
is_internal_call

Check Internal Guard Flag
get_layout_calls

Get LAYOUT Calls
get_all_patchable_functions

Get All Patchable Functions
initialize_ggplot2_system

ggplot2 System Initialization
extract_scale_mapping

Extract scale mapping from built plot
get_all_function_names

Get Flat List of All Patchable Functions
initialize_base_r_system

Base R System Initialization
get_high_level_calls

Get HIGH-level Calls
generate_robust_selector

Generate robust selector for any element type
maidr_html_dependencies

Register JS/CSS dependencies for maidr with auto-detection
get_global_registry

Get the global plot system registry
get_device_calls_by_class

Filter Device Calls by Classification
get_group_count

Get Group Count
is_fallback_enabled

Check if Fallback is Enabled
maidr_local_assets

Get paths to local MAIDR assets
is_fallback_warning_enabled

Check if Fallback Warning is Enabled
generate_unique_id

Generate a unique ID for MAIDR plots
is_layout_function

Check if Function is LAYOUT-level
maidr_widget_output

MAIDR Widget Output for Shiny UI (Internal Alternative)
get_panel_config

Get Panel Configuration
is_multipanel_active

Check if Multi-panel Layout is Active
get_plot_calls

Get recorded plot calls
get_original_function

Get original (unwrapped) function by name
is_maidr_temp_device

Check if the current device is the MAIDR temp device
get_low_level_calls

Get LOW-level Calls
map_visual_to_dom_panel

Map visual panel position to DOM panel name
get_device_storage_summary

Get Device Storage Summary
prefix_to_currency_code

Convert Currency Prefix to ISO 4217 Code
maidr_get_fallback

Get Current MAIDR Fallback Settings
maidr_set_fallback

Configure MAIDR Fallback Behavior
extract_from_scales_closure

Extract Format Configuration from scales Package Closure
maidr_cdn_url

Get the MAIDR CDN base URL
maidr_widget

Create MAIDR htmlwidget
find_graphics_plot_grob

Utility functions for robust selector generation in Base R plots
display_html_file

Display HTML file in browser
get_facet_groups

Get facet group information for a panel
has_device_calls

Check if Device Has Calls
get_all_plot_groups

Get All Plot Groups
.base_r_function_classes

Base R Function Classification
process_faceted_plot_data

Facet Processing Utilities
process_facet_panel

Process a single facet panel
get_functions_by_class

Get All Functions of a Specific Class
wrap_s3_generics

Wrap S3 generic functions (lines and points)
is_low_level_function

Check if Function is LOW-level
r_date_format_to_intl_options

Convert R Date Format to Intl.DateTimeFormat Options
is_maidr_on

Check if MAIDR RMarkdown Mode is Enabled
get_current_plot_index

Get Current Plot Index
get_fallback_format

Get Fallback Image Format
process_patchwork_plot_data

Patchwork Processing Utilities
reset_global_registry

Reset the global registry (mainly for testing)
initialize_base_r_patching

Initialize Base R function patching
process_patchwork_panel

Process a single patchwork panel
save_html

Save Interactive Plot as HTML File
run_example

Run MAIDR Example Plots
find_original_function

Find the original function in loaded namespaces
maidr_on

Enable MAIDR Rendering in RMarkdown
maidr_off

Disable MAIDR Rendering in RMarkdown
get_device_state

Base R State Tracking
organize_facet_grid

Organize subplots into 2D grid structure
open_maidr_temp_device

Open a temporary device to suppress default graphics window
r_date_format_to_js_function

Convert R Date Format to JavaScript Function
is_html_output

Check if current knitr output format is HTML
is_high_level_function

Check if Function is HIGH-level
get_device_storage

Get or Initialize Device Storage
get_plot_group

Get Plot Group by Index
group_device_calls

Base R Plot Grouping
restore_original_functions

Restore original functions
maidr_output

MAIDR Output Container for Shiny UI
knit_print.density

Custom knit_print Method for density Objects
knit_print.ggplot

Custom knit_print Method for ggplot Objects
is_patching_active

Check if patching is active
is_patching_enabled

Check if Base R patching is currently active
knit_print.histogram

Custom knit_print Method for histogram Objects
log_plot_call_to_device

Log Plot Call to Device Storage
maidr_plot_hook

knitr Plot Hook for Base R Plots
render_maidr

Render MAIDR Plot in Shiny Server
show

Display Interactive MAIDR Plot
set_internal_guard

Set Internal Guard Flag
scale_mapping_utils

Scale Mapping Utilities for Faceted Plots
save_html_document

Save HTML document to file
on_high_level_call

Handle HIGH-level Call
on_layout_call

Handle LAYOUT Call
wrap_function

Wrap a single function
update_device_state

Update Device State
reset_device_state

Reset Device State
replay_to_native_device

Replay Base R plot to native graphics device
render_maidr_widget

Render MAIDR Widget in Shiny Server (Internal Alternative)
replay_base_r_plot

Replay Base R Plot from Device Storage