New to python - What is the difference between %matplotlib inline
and import matplotlib
?
Asked
Active
Viewed 338 times
0

Manu Chadha
- 15,555
- 19
- 91
- 184
-
1One difference is that `import matplotlib` is valid Python and `%matplotlib inline` is not :) Did you mean to tag this with `jupyter` and/or `jupyter-notebook` as well? – Thomas Sep 21 '22 at 09:36
-
In modern Jupyter, you often no longer need `%matplotlib inline`. See [here](https://stackoverflow.com/a/73633497/8508004) for understanding how even if not necessary you may wish to use it if you are regularly employing advanced Matplotlib settings. As for importing the matplotlib module, core Python is kept sparse for more flexibility/cleaner namespace & so in Python you need to import additional modules and packages that are more domain specific. – Wayne Sep 21 '22 at 19:27
1 Answers
0
The part with the %
is called a magic-command and only available in Jupyter/Ipython.
The import
is part of python to import modules.
See:

sebsch
- 13
- 6