Make matplotlib, seaborn, Plotly, and Altair charts accessible — MAIDR (Multimodal Access and Interactive Data Representation) for Python.
py-maidr makes data visualizations accessible to blind and low-vision readers.
import maidr and your existing plotting code renders an interactive figure that
can be navigated by keyboard, heard as sonification, read on a braille
display, and described as text — the same chart in four modalities instead
of one.
Nothing about how you plot changes. py-maidr patches matplotlib and seaborn at
import time, so plt.show() produces accessible HTML instead of a static image;
Plotly and Altair figures go through the same maidr.show() entry point. It
works in a plain script, a Jupyter notebook, Quarto, Shiny, and Streamlit.
import matplotlib.pyplot as plt
import seaborn as sns
import maidr # the whole integration
penguins = sns.load_dataset("penguins")
fig, ax = plt.subplots()
sns.barplot(x="species", y="body_mass_g", data=penguins, ax=ax)
maidr.show(fig)maidr.save_html(fig, "penguins.html") writes the same plot to a standalone HTML
file instead of displaying it. Because importing maidr also activates its
matplotlib backend, a plain plt.show() renders accessible output too.
| Plotting libraries | matplotlib, seaborn (including seaborn.objects), Plotly, Altair — plus mplfinance for financial charts (candlestick, volume, moving averages) |
| Environments | Python scripts, Jupyter, Quarto, Shiny for Python, Streamlit |
| Plot types | 38 — see Plot Type Stability for which fifteen are settled and which twenty-three are experimental |
Plot types not yet supported fall back to a static image with a warning, so a plot is never lost.
# install the latest release from PyPI
pip install -U maidr# or install the development version from GitHub
pip install -U git+https://github.com/xability/py-maidr.gitPlease visit the user guide page.
py-maidr loads its JavaScript from a CDN by default, and resolves the current published version so browsers cannot serve a stale cached copy. That costs one bounded outbound request, the first time a plot is rendered. import maidr itself makes no request.
If you work air-gapped, behind a proxy, or in CI:
export MAIDR_CDN_VERSION=bundled # serve the version in this wheel, no lookup
export MAIDR_USE_CDN=false # or skip the CDN entirelybundled is usually the best choice for restricted networks: it emits an immutable
CDN URL — so browser caching still works correctly — without contacting anything.
It is also the only one of the two that covers Altair charts: the Altair adapter
has no offline path and always references the CDN, so MAIDR_USE_CDN=false does not
apply to it, while MAIDR_CDN_VERSION=bundled still removes the lookup.
See Offline Use and the JavaScript Bundle for the full set of options.
We provide some example code for using py-maidr with matplotlib, seaborn, Jupyter Notebook, Quarto, Shiny, and Streamlit.
Shiny support requires the optional extra pip install "maidr[shiny]", which
provides output_maidr() and @render_maidr in maidr.widget.shiny.
Streamlit support requires pip install "maidr[streamlit]", which provides
render_maidr() and maidr_html() in maidr.widget.streamlit.
Bug reports, plot types and documentation fixes are all welcome — see CONTRIBUTING.md for how to set up a development environment and shape a change, and CONDUCT.md for our code of conduct.
GPL-3.0-or-later. See LICENSE.