arviz.interactive_backend#

class arviz.interactive_backend(backend='')[source]#

Context manager to change backend temporarily in ipython sesson.

It uses ipython magic to change temporarily from the ipython inline backend to an interactive backend of choice. It cannot be used outside ipython sessions nor to change backends different than inline -> interactive.

Parameters:
backendstr, optional

Interactive backend to use. It will be passed to %matplotlib magic, refer to its docs to see available options.

Notes

The first time interactive_backend context manager is called, any of the available interactive backends can be chosen. The following times, this same backend must be used unless the kernel is restarted.

Examples

Inside an ipython session (i.e. a jupyter notebook) with the inline backend set:

>>> import arviz as az
>>> idata = az.load_arviz_data("centered_eight")
>>> az.plot_posterior(idata) # inline
>>> with az.interactive_backend():
...     az.plot_density(idata) # interactive
>>> az.plot_trace(idata) # inline

Methods