Michael Debo
Michael Debo

Reputation: 107

Python errors using "%matplotlib inline"

I am working on a python program that using matplotlib. I have it installed into the program, but when I try to add "%matplotlib inline" I am getting syntax errors.

import matplotlib.pyplot as plt

%matplotlib inline

When I test with just these two lines, I am returning a syntax error on the "%". I have tried reinstalling matplotlib through pip to no avail. Any help would be appreciated.

Upvotes: 0

Views: 84

Answers (1)

Ilya V. Schurov
Ilya V. Schurov

Reputation: 8047

%matplotlib inline

is not a Python command, it's so-called IPython magic command that is working in Jupyter or pure IPython environment only. IDLE doesn't support it, and it cannot show you figures inline.

Upvotes: 1

Related Questions