.. _checkmatplotlibbackendrst: ======================== Check matplotlib backend ======================== .. only:: html **Links:** :download:`notebook `, :downloadlink:`html `, :download:`PDF `, :download:`python `, :downloadlink:`slides `, :githublink:`GitHub|_doc/notebooks/check_matplotlib_backend.ipynb|*` 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. .. code:: ipython3 %matplotlib inline .. code:: ipython3 import matplotlib matplotlib.get_backend() .. parsed-literal:: 'module://ipykernel.pylab.backend_inline' .. code:: ipython3 import pyquickhelper .. code:: ipython3 import matplotlib matplotlib.get_backend() .. parsed-literal:: '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. .. code:: ipython3 %load_ext pyquickhelper .. code:: ipython3 import matplotlib matplotlib.get_backend() .. parsed-literal:: 'module://ipykernel.pylab.backend_inline' .. code:: ipython3 %matplotlib inline .. code:: ipython3 import matplotlib matplotlib.get_backend() .. parsed-literal:: 'module://ipykernel.pylab.backend_inline'