def enable_matplotlib(self, gui=None):
    "Enable interactive matplotlib and inline figure support.\n\n        This takes the following steps:\n\n        1. select the appropriate eventloop and matplotlib backend\n        2. set up matplotlib for interactive use with that backend\n        3. configure formatters for inline figure display\n        4. enable the selected gui eventloop\n\n        Parameters\n        ----------\n        gui : optional, string\n            If given, dictates the choice of matplotlib GUI backend to use\n            (should be one of IPython's supported backends, 'qt', 'osx', 'tk',\n            'gtk', 'wx' or 'inline'), otherwise we use the default chosen by\n            matplotlib (as dictated by the matplotlib build-time options plus the\n            user's matplotlibrc configuration file).  Note that not all backends\n            make sense in all contexts, for example a terminal ipython can't\n            display figures inline.\n        "
    from matplotlib_inline.backend_inline import configure_inline_support
    from IPython.core import pylabtools as pt
    (gui, backend) = pt.find_gui_and_backend(gui, self.pylab_gui_select)
    if (gui != 'inline'):
        if (self.pylab_gui_select is None):
            self.pylab_gui_select = gui
        elif (gui != self.pylab_gui_select):
            print(('Warning: Cannot change to a different GUI toolkit: %s. Using %s instead.' % (gui, self.pylab_gui_select)))
            (gui, backend) = pt.find_gui_and_backend(self.pylab_gui_select)
    pt.activate_matplotlib(backend)
    configure_inline_support(self, backend)
    self.enable_gui(gui)
    self.magics_manager.registry['ExecutionMagics'].default_runner = pt.mpl_runner(self.safe_execfile)
    return (gui, backend)
Enable interactive matplotlib and inline figure support.

This takes the following steps:

1. select the appropriate eventloop and matplotlib backend
2. set up matplotlib for interactive use with that backend
3. configure formatters for inline figure display
4. enable the selected gui eventloop

Parameters
----------
gui : optional, string
    If given, dictates the choice of matplotlib GUI backend to use
    (should be one of IPython's supported backends, 'qt', 'osx', 'tk',
    'gtk', 'wx' or 'inline'), otherwise we use the default chosen by
    matplotlib (as dictated by the matplotlib build-time options plus the
    user's matplotlibrc configuration file).  Note that not all backends
    make sense in all contexts, for example a terminal ipython can't
    display figures inline.
def enable_matplotlib(self, gui=None):
    "Enable interactive matplotlib and inline figure support.\n\n        This takes the following steps:\n\n        1. select the appropriate eventloop and matplotlib backend\n        2. set up matplotlib for interactive use with that backend\n        3. configure formatters for inline figure display\n        4. enable the selected gui eventloop\n\n        Parameters\n        ----------\n        gui : optional, string\n            If given, dictates the choice of matplotlib GUI backend to use\n            (should be one of IPython's supported backends, 'qt', 'osx', 'tk',\n            'gtk', 'wx' or 'inline'), otherwise we use the default chosen by\n            matplotlib (as dictated by the matplotlib build-time options plus the\n            user's matplotlibrc configuration file).  Note that not all backends\n            make sense in all contexts, for example a terminal ipython can't\n            display figures inline.\n        "
    from matplotlib_inline.backend_inline import configure_inline_support
    from IPython.core import pylabtools as pt
    (gui, backend) = pt.find_gui_and_backend(gui, self.pylab_gui_select)
    if (gui != 'inline'):
        if (self.pylab_gui_select is None):
            self.pylab_gui_select = gui
        elif (gui != self.pylab_gui_select):
            print(('Warning: Cannot change to a different GUI toolkit: %s. Using %s instead.' % (gui, self.pylab_gui_select)))
            (gui, backend) = pt.find_gui_and_backend(self.pylab_gui_select)
    pt.activate_matplotlib(backend)
    configure_inline_support(self, backend)
    self.enable_gui(gui)
    self.magics_manager.registry['ExecutionMagics'].default_runner = pt.mpl_runner(self.safe_execfile)
    return (gui, backend)