Slartibartfast
Slartibartfast

Reputation: 1190

Plotting inline in matplotlib

I am using the terminal in jupyter and am trying to plot with matplotlib. I need to plot inline and so i use %matplotlib inline but i am getting the following error:

>>> %matplotlib inline
  File "<stdin>", line 1
    %matplotlib inline
    ^
SyntaxError: invalid syntax

Why am i getting this error? Is it because it is a terminal and not jupyter notebook type environment? I had tried the same code in jupyter notebook and it did not return any errors.

Upvotes: 0

Views: 225

Answers (2)

jineshmehta
jineshmehta

Reputation: 19

trying using 'exec(%matplotlib inline)'. Works for me on python3.6

Upvotes: 0

Christos Sevastiadis
Christos Sevastiadis

Reputation: 161

You should run ipython instead of python in the Jupyter terminal. Then you can execute any magic command.

Upvotes: 1

Related Questions