Jupyter & IPython: What does% matplotlib inline do?

I'm curious that a jupyter laptop allows you to embed the plot. I searched %matplotlib inlineon github and did not find the source code ( https://github.com/search?l=python&q=org%3Ajupyter+matplotlib+inline&ref=searchresults&type=Code&utf8=%E2%9C%93 ).

And this is not available in the docs ( http://ipython.readthedocs.io/en/stable/interactive/magics.html#magic-matplotlib ).

Can someone tell me where I can see the source code %matplotlib inline?

+4
source share
1 answer

You can find the source of matroplatinum magic in jupyter laptop through

%matplotlib?? # view source

From here we will find the code in python3.5/site-packages/IPython/core/magics/pylab.py

    args = magic_arguments.parse_argstring(self.matplotlib, line)
    if args.list:
        backends_list = list(backends.keys())
        print("Available matplotlib backends: %s" % backends_list)
    else:
        gui, backend = self.shell.enable_matplotlib(args.gui)
        self._show_matplotlib_backend(args.gui, backend)

, , - self.shell.enable_matplotlib. gythub IPython: https://github.com/ipython/ipython/blob/aa586fd81940e557a1df54ecd0478f9d67dfb6b4/IPython/core/magics/pylab.py#L100

interactiveiveshell.py: https://github.com/ipython/ipython/blob/aa586fd81940e557a1df54ecd0478f9d67dfb6b4/IPython/core/interactiveshell.py#L2918-L2961

+4

All Articles