Matplotlib & Seaborn Accessible Plot Examples
Matplotlib / Seaborn Examples
Making accessible data representation with maidr is easy and straightforward. If you already have data visualization code using matplotlib or seaborn, you can make your plots accessible with maidr in just a few lines of code. For Plotly examples, see the Plotly Examples page, and for Altair the Altair Examples page.
Simply import maidr and call plt.show() as usual. maidr automatically activates a custom matplotlib backend, so plt.show() renders accessible HTML output (with sonification, braille, and tactile support) instead of a static image.
Custom Backend
When you import maidr, a custom matplotlib backend is automatically activated. This means plt.show() renders accessible HTML output instead of a static image.
Switching Back to the Default Renderer
If you want to temporarily use the default matplotlib renderer (e.g. for unsupported plot types or debugging), you can switch the backend:
In Jupyter notebooks:
maidr.set_backend(use_maidr=False) # plt.show() now renders static inline images
maidr.set_backend(use_maidr=True) # plt.show() renders accessible maidr output againIn Python scripts (non-notebook):
maidr.set_backend(use_maidr=False) # plt.show() now opens the native image viewer (e.g. macOS, TkAgg)
maidr.set_backend(use_maidr=True) # plt.show() renders accessible maidr output againmaidr.show() always renders accessible output regardless of the active backend. You only need maidr.set_backend() to control the behavior of plt.show().
Unsupported Plot Types
For plot types not yet supported by maidr (e.g. 3D plots; see Plot Type Stability for the full list), plt.show() will automatically fall back to displaying a static image and emit a warning. No code changes are needed: your plots will always be visible.
Examples by plot family
Each family has its own page so the code, the rendered accessible chart and the notes on how py-maidr reads that chart stay together. Every page starts with import maidr and ends with plt.show(); the plot types marked experimental on Plot Type Stability are flagged on their pages.
- Bar, count, stacked and dodged bar charts: one tone per bar, Up and Down between series in a stacked or dodged chart.
- Pie charts and word clouds: a flat row of labeled values, with each slice’s share of the whole computed at render time.
- Histograms and KDE plots: bins read as ranges with counts, densities read as a smooth curve.
- Line, multi-line and step plots: pitch follows the value along x; step plots report which side of a sample the value is held on.
- Heatmaps, hexbin and contour plots: grids navigated with all four arrows, hexagonal bins by center, contours one level curve at a time.
- Box, boxen and violin plots: five-number summaries, letter-value ladders and density curves paired with box statistics.
- Area, error bar, point and lollipop plots: running totals for stacked areas and a lower bound, estimate, upper bound grid for intervals.
- Scatter and regression plots: points in x order, with the fitted line as a separate layer.
- Multi-layer, multi-panel and facet plots: Page Up and Page Down between layers, a subplot list for panels.
- Candlestick and Gantt charts: open, high, low and close per day; start and end per task span.
- Shiny and Streamlit dashboards: reactive apps, HTML caching and air-gapped deployments (no executed plots).
Interactive Computing (Jupyter Notebooks, Jupyter Labs, Google Colab)
Check out this interactive notebook in Google Colab.
Other Examples
We provide some example code for using py-maidr with matplotlib, seaborn, Jupyter Notebook, Quarto, Shiny, and Streamlit.
Keyboard Shortcuts and Controls
To interact with the plots using maidr, follow these steps:
- Press the Tab key to focus on the plot element.
- Use the arrow keys to move around the plot.
- Press B to toggle Braille mode.
- Press T to toggle Text mode.
- Press S to toggle Sonification (tones) mode.
- Press R to toggle Review mode.
The full list is the keyboard shortcut table on the Welcome page, which is where it is maintained.
Demo Video
A walkthrough of py-maidr in a notebook is on YouTube: maidr demo video. Bug reports, the code of conduct, the license and the maintainers are listed on the Welcome page.