Thorn Thorn - 2 months ago 15
Python Question

matplotlib does not show my drawings although I call

I need your help about matplotlib. Yes, I did not forget calling the

$ ipython --pylab

import matplotlib.pyplot as p
p.plot(range(20), range(20))

It returns
matplotlib.lines.Line2D at 0xade2b2c
as the output.

There is nothing to happen. No error message. No new window. Nothing. I install
by using pip and I didn't take any error messages.


I use,

  • Ubuntu

  • IPython v0.11

  • Python v2.6.6

  • matplotlib v1.0.1


If I set my backend to template in ~/.matplotlib/matplotlibrc, then I can reproduce your symptoms:


# backend      : GtkAgg
backend      : template

Note that the file matplotlibrc may not be in directory ~/.matplotlib/. In this case, the following code shows where it is:

>>> import matplotlib
>>> matplotlib.matplotlib_fname()

In [1]: import matplotlib.pyplot as p

In [2]: p.plot(range(20),range(20))
Out[2]: [<matplotlib.lines.Line2D object at 0xa64932c>]

In [3]:

If you edit ~/.matplotlib/matplotlibrc and change the backend to something like GtkAgg, you should see a plot. You can list all the backends available on your machine with

import matplotlib.rcsetup as rcsetup

It should return a list like:

['GTK', 'GTKAgg', 'GTKCairo', 'FltkAgg', 'MacOSX', 'QtAgg', 'Qt4Agg',
'TkAgg', 'WX', 'WXAgg', 'CocoaAgg', 'agg', 'cairo', 'emf', 'gdk', 'pdf',
'ps', 'svg', 'template']