set_backend

set_backend(use_maidr=True)

Switch the matplotlib backend between maidr and the platform default.

When use_maidr=True, the maidr backend is activated so that plt.show() renders accessible HTML output. When use_maidr=False, the original platform backend is restored (e.g. macosx, TkAgg, or inline in Jupyter).

In Jupyter notebooks, restoring the inline backend requires special handling to re-register the post_execute hooks that auto-display figures. This is handled automatically.

Parameters

Name Type Description Default
use_maidr bool If True (default), activate the maidr accessible backend. If False, restore the original matplotlib backend that was active before maidr was imported. True

Examples

>>> import maidr
>>> maidr.set_backend(use_maidr=False)   # use platform default backend
>>> maidr.set_backend(use_maidr=True)    # back to maidr

Notes

maidr.show() always renders accessible output regardless of the active backend. set_backend only controls the behavior of plt.show().