streamlit.render_maidr

widget.streamlit.render_maidr(
    plot=None
    *
    height='content'
    width='stretch'
    tab_index=None
    use_cdn=None
)

Draw an accessible MAIDR chart in a Streamlit app.

Parameters

Name Type Description Default
plot Any The plot to render – a matplotlib or seaborn artist, a Plotly Figure, or an Altair chart. None uses the current matplotlib figure, and warns: that figure is process-global, and Streamlit runs sessions on separate threads, so by the time it is rendered it may be another session’s. Pass the plot explicitly. None
height (int, {'content', 'stretch'}) Height of the embed. "content" lets Streamlit measure the chart, which is what keeps maidr’s braille and text panels visible when they open. "content"
width (int, {'content', 'stretch'}) Width of the embed. "stretch"
tab_index int or None Tab order of the frame, passed through to Streamlit. None is the browser default and is deliberate: an iframe’s contents already take part in sequential focus navigation, and maidr gives the chart inside its own tab stop, so a keyboard user tabs straight onto the chart. Passing 0 makes the frame itself a stop as well, which is one extra Tab before the chart – and Streamlit hardcodes the frame’s accessible name as st.iframe, so that stop announces the same on every chart on the page. It is exposed for layouts that want a deterministic landing point, not because the chart needs it to be reachable. None
use_cdn bool, {"auto"}, or None Where the chart loads maidr.js from; see :func:maidr.render. Pass False for an air-gapped deployment. Prefer this argument over :func:maidr.set_use_cdn: the setter writes process-wide state, and Streamlit runs sessions on separate threads, so one session calling it changes what every other session renders. None

Returns

Name Type Description
None Nothing is returned. The embed sends no data back, and handing back a Streamlit object would suggest an interactivity this does not have.

Examples

>>> import matplotlib.pyplot as plt
>>> from maidr.widget.streamlit import render_maidr
>>>
>>> fig, ax = plt.subplots()
>>> ax.bar(["a", "b"], [1, 2])
>>> render_maidr(ax)