python SyntaxError: invalid syntax %matplotlib inline

if you are not using Jupyter IPython notebook, just comment out (or delete) the line, everything will work fine and a separate plot window will be opened if you are running your python script from the console.

However, if you are using Jupyter IPython notebook, the very first python code cell in your notebook should have the line “%matplotlib inline” for you to be able to view any plot.

Leave a Comment