Skip to content Skip to sidebar Skip to footer

Importing Pyplot In A Jupyter Notebook

Running Python 2.7 and trying to get plotting to work the tutorials recommend the below command. from matplotlib import pyplot as plt Works fine when run from the command line pyt

Solution 1:

You can also use the %matplotlib inline magic, but it has to be preceded by the pure %matplotlib line:

Works (figures in new window)

%matplotlib
import matplotlib.pyplotas plt

Works (inline figures)

%matplotlib
%matplotlib inlineimport matplotlib.pyplot as plt

Does not work

%matplotlib inlineimport matplotlib.pyplot as plt

Also: Failure to import matplotlib.pyplot in jupyter (but not ipython) seems to be the same issue. It looks like a recently introduced bug in the ipykernel. Maybe someone mark this or the other question as duplicate, thx.

Post a Comment for "Importing Pyplot In A Jupyter Notebook"