For the life of me, I can not get matplotlib to display graphs in ipython inactively.
I’ve tried two approaches – each time, I get the same results:
In [10]: plot([1,2,3])
Out[10]: [<matplotlib.lines.Line2D at 0x104e9ca50>]
Here are the two approaches I have tried so far:
Using the documentation as a guide, I tried two different approaches:
First:
ipython --pylab
plot([1,2,3])
xlabel('hi mom')
In [3]: plot([1,2,3])
Out[3]: [<matplotlib.lines.Line2D at 0x107e369d0>]
Second:
ipython
import numpy
import pylab
In [5]: pylab.plot([1,2,3])
Out[5]: [<matplotlib.lines.Line2D at 0x104ca7b90>]
How do I get the plot to display?
It’s possible you have a non-GUI backend set. Try doing
pylab.get_backend()to see what backend you have set. Look at the documentation here and here to see how to set your backend.