Currently, whenever a Jupyter Notebook is launched, the MPLBACKEND environment variable is set to module://ipykernel.pylab.backend_inline in init_gui from ipykernel.kernelapp.
While this sets matplotlib's backend to inline, figures not created via pyplot will not be shown in the notebook output.

This is because the function configure_inline_support from python.core.pylabtools is never run. It is responsible for hooking a function that gets triggered whenever a matplotlib figure is the output of a cell. The function calls the figure's canvas's print_figure function and returns the raw bytes of the image.
This function configure_inline_support does get run when matplotlib.pyplot is imported and when %matplotlib inline is run.
Having to do either of these things can be eliminated by running configure_inline_support within init_gui after the shell is retrieved. I think the following could be enough:
from IPython.core.pylabtools import configure_inline_support
configure_inline_support(shell, 'module://ipykernel.pylab.backend_inline')
I'd be very excited to have this change and never worry about running %matplotlib inline again.
Currently, whenever a Jupyter Notebook is launched, the
MPLBACKENDenvironment variable is set tomodule://ipykernel.pylab.backend_inlineininit_guifromipykernel.kernelapp.While this sets matplotlib's backend to inline, figures not created via pyplot will not be shown in the notebook output.
This is because the function
configure_inline_supportfrompython.core.pylabtoolsis never run. It is responsible for hooking a function that gets triggered whenever a matplotlib figure is the output of a cell. The function calls the figure's canvas'sprint_figurefunction and returns the raw bytes of the image.This function
configure_inline_supportdoes get run whenmatplotlib.pyplotis imported and when%matplotlib inlineis run.Having to do either of these things can be eliminated by running
configure_inline_supportwithininit_guiafter the shell is retrieved. I think the following could be enough:I'd be very excited to have this change and never worry about running
%matplotlib inlineagain.