I was working on a project in which I had to write
%matplotlib inline
at the beginning to solve a problem.
But I'm wondering what does this "%" stands for: is it an operator ? Has it a name so I could do some researches about it ?
You are not looking at standard Python code.
You are almost certainly using an IPython interactive session, and it uses %
as a prefix to recognize special commands, called magic functions. Type %quickref
to get a quick reference. From that reference:
%magic
: Information about IPython's 'magic'%
functions.Magic functions are prefixed by
%
or%%
, and typically take their arguments without parentheses, quotes or even commas for convenience. Line magics take a single%
and cell magics are prefixed with two%%
.
If you then type in %magic
you'll find the reference documentation for available magic functions, including:
%matplotlib
:%matplotlib [gui]
Set up matplotlib to work interactively.
This function lets you activate matplotlib interactive support at any point during an IPython session. It does not import anything into the interactive namespace.