We are already familiar with one of the magic command, that is,
%pylab inline. This particular magic does two of the following things: it imports
matplotlib, and sets up the notebook for inline plots. To see one of the other options, change the cell to
Run this cell and then run the cell that produces the plot again. Instead of drawing the graph inline, IPython will now open a new window with the plot as shown in the following screenshot:
This window is interactive and you can resize the graph, move it, and save it to a file from here.
Another useful magic is
%timeit, which records the time it takes to run a line of Python code. Run the following code in a new cell in the notebook: