How to make IPython notebook matplotlib plot inline

To make matplotlib plots show up inline in an IPython notebook, you can use the following code snippet:

%matplotlib inline

Watch a course Python - The Practical Guide

You should place this code at the beginning of your notebook before creating any plots. This will configure matplotlib to display plots directly in the output cells of the notebook, rather than in separate windows.

import matplotlib.pyplot as plt
%matplotlib inline

# Create a plot
plt.plot([1, 2, 3, 4])
plt.ylabel('some numbers')
plt.show()

This will generate the plot inline in the output cell