I need your help about matplotlib. Yes, I did not forget calling the pyplot.show().
$ ipython --pylab
import matplotlib.pyplot as p
p.plot(range(20), range(20))
It returns matplotlib.lines.Line2D at 0xade2b2c
as the output.
p.show()
There is nothing to happen. No error message. No new window. Nothing. I install matplotlib
by using pip and I didn't take any error messages.
Details:
I use,
- Ubuntu
- IPython v0.11
- Python v2.6.6
- matplotlib v1.0.1
I had to install matplotlib from source to get this to work. The key instructions (from http://www.pyimagesearch.com/2015/08/24/resolved-matplotlib-figures-not-showing-up-or-displaying/) are:
By changing the backend, as @unutbu says, I just ran into loads more problems with all the different backends not working either.
%matplotlib inline
For me working with notebook, adding the above line before the plot works.
For me the problem happens if I simply create an empty
matplotlibrc
file under~/.matplotlib
on macOS. Adding "backend: macosx" in it fixes the problem.I think it is a bug: if
backend
is not specified in mymatplotlibrc
it should take the default value.I found that I needed
window = Tk()
and thenwindow.mainloop()
For Ubuntu 12.04:
Similar to @Rikki, I solved this problem by upgrading
matplotlib
withpip install matplotlib --upgrade
. If you can't upgrade uninstalling and reinstalling may work.