Late answer, may be useful for newer versions:
In newer matplotlib and jupyter versions, this works for me:
import matplotlib_inline