Check matplotlib backend¶

Links: notebook, html, PDF, python, slides, slides(2), GitHub

The notebook checks matplotlib backend. The backend defines the devices the module is using to show the results. backend_inline should be the value inside a notebook.

%matplotlib inline
import matplotlib
matplotlib.get_backend()
'module://ipykernel.pylab.backend_inline'
import pyquickhelper
import matplotlib
matplotlib.get_backend()
'module://ipykernel.pylab.backend_inline'

The following instruction tends to change matplotlib backend, we just check it does not happen. If this changes, check you did not import a module which import matplotlib or did run the following:

from matplotlib.sphinxext.plot_directive import setup as setup_plot
from matplotlib.sphinxext.only_directives import setup as setup_only

The backend might change in that case to 'agg' and graphs will not be displayed into the notebook.

%load_ext pyquickhelper
import matplotlib
matplotlib.get_backend()
'module://ipykernel.pylab.backend_inline'
%matplotlib inline
import matplotlib
matplotlib.get_backend()
'module://ipykernel.pylab.backend_inline'