Matplotlib & Seaborn Accessible Plot Examples

Overview of py-maidr examples for matplotlib and seaborn: bar, histogram, line, box, heatmap, scatter and more, one page per plot family.

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 again

In 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 again
Note

maidr.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.

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:

  1. Press the Tab key to focus on the plot element.
  2. Use the arrow keys to move around the plot.
  3. Press B to toggle Braille mode.
  4. Press T to toggle Text mode.
  5. Press S to toggle Sonification (tones) mode.
  6. 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.