So I went through some questions being posted about the usage of %matplotlib inline function in Jupyter Notebook, I do understand that "%matplotlib inline sets the backend of matplotlib to the 'inline' backend" & "When using the 'inline' backend, your matplotlib graphs will be included in your notebook, next to the code". But, I don't see any difference in my plot results with or without the use of "%matplotlib inline". Can someone explain this to me if I am misunderstanding something? Here's a simple code I have tried:
Graph with %matplotlib inline
%matplotlib inline
import matplotlib as mpl
import matplotlib.pyplot as plt
plt.plot([[0,0],[1,1]], linewidth=4, label='random diagonal')
In the next code, I just took off the %matplotlib inline and it gives still gives me the same result. What is the point of using or not using the "%matplotlib inline" function then?
Thanks to @ImportanceOfBeingErnest, figured that the problem comes from the notebook backend already set to inline. Once you run the code matplotlib.get_backend(), you can see the backend within the notebook is already set to inline by default. I am guessing this comes as a default now in Anaconda's version of Python 3.7's notebooks.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With