Help required displaying matplotlib plots in ipython. I did not forget to call pyplot.show().
$ ipython –pylab
import matplotlib.pyplot as plt
plt.plot(range(20), range(20))
It returns matplotlib.lines.Line2D at 0xade2b2c as the output.
plt.show()
Nothing happens. No error message. No new window. I installed matplotlib with pip, and no error messages occurred.
Details:
I use,
- Ubuntu
- IPython v0.11
- Python v2.6.6
- matplotlib v1.0.1
If I set my backend to
templatein~/.matplotlib/matplotlibrc,then I can reproduce your symptoms:
~/.matplotlib/matplotlibrc:
Note that the file
matplotlibrcmay not be in directory~/.matplotlib/. In this case, the following code shows where it is:If you edit
~/.matplotlib/matplotlibrcand change the backend to something likeGtkAgg, you should see a plot. You can list all the backends available on your machine withIt should return a list like:
Reference: