2
import matplotlib
import numpy as np
import matplotlib.pyplot as plt

''' see the line bellow '''
%matplotlib inline # <- here

I understand what '%' is for in math and in strings, but what does it do here? Is it also a string? Can't tell. Can some one elaborate.

Edit: Folks in the comments helped me to narrow it down to ipython/Jupyter.

python 2

python 3

And if you are using ipython, try %magic to get more info on magic ipython/Jupyter functions.

user
  • 2,939
  • 5
  • 26
  • 39
  • 6
    It terminates the script with SyntaxError. – vaultah Mar 29 '16 at 16:56
  • 6
    Technically, it's not Python. It marks a special builtin command provided by the iPython interpreter. – chepner Mar 29 '16 at 16:56
  • @chepner if you think it's correct maybe you can put it as an answer and I'll mark it since you are first. – user Mar 29 '16 at 17:00
  • You could just search that... http://nbviewer.jupyter.org/github/ipython/ipython/blob/1.x/examples/notebooks/Part%203%20-%20Plotting%20with%20Matplotlib.ipynb – OneCricketeer Mar 29 '16 at 17:00

0 Answers0