API Reference

Displaying an accessible and interactive plot with multimodal formats

Plots generated by matplotlib, seaborn, Plotly or Altair can be displayed in MAIDR format. Pass the plot object to maidr.show(), or call plt.show() after import maidr and let the custom backend do it.

show Display a MAIDR plot.
render Render a MAIDR plot to HTML.
Maidr.show Preview the HTML content using the specified renderer.

Saving a maidr plot as an HTML file

Save a plot as a standalone HTML file with maidr.save_html().

save_html Save a MAIDR plot as HTML file.
Maidr.save_html Save the HTML representation of the figure with MAIDR to a file.

Registering and releasing figures

Mark a bar container as a stacked bar plot with maidr.stacked(), and release the figures maidr tracks with maidr.close().

stacked
close Close a MAIDR plot and clean up resources.

Switching the matplotlib backend

Control whether plt.show() uses the maidr accessible backend or the platform default with maidr.set_backend().

set_backend Switch the matplotlib backend between maidr and the platform default.

Where the maidr.js runtime comes from

Choose between the jsDelivr CDN and the copy bundled in the wheel with maidr.set_use_cdn(), and emit the notebook loader by hand with maidr.init_notebook().

set_use_cdn Set the process-wide default for use_cdn.
get_use_cdn Return the current default for use_cdn.
init_notebook Inject the bundled maidr.js / maidr-math.css into the notebook DOM.

Shiny for Python

Pair output_maidr() in the UI with @render_maidr in the server. Requires the shiny extra: pip install "maidr[shiny]".

shiny.output_maidr Create a container for a :class:render_maidr output.
shiny.render_maidr Render a plot as an accessible MAIDR chart in a Shiny app.

Streamlit

Place an accessible chart in a Streamlit app with render_maidr(), or get the HTML string to cache with maidr_html(). Requires the streamlit extra: pip install "maidr[streamlit]".

streamlit.render_maidr Draw an accessible MAIDR chart in a Streamlit app.
streamlit.maidr_html Return an accessible chart as a self-contained HTML string.