Ubuntu – Backend for python3 module matplotlib

gtkmatplotlibpython3

I'm trying to use python3 to plot graphs.

The only back-end for matplotlib that seems to work is tkAgg (Tkinter), however this looks like it has been designed in the Stone Age. So I was trying to find a replacement. As I'm using Unity which is based on Gnome and which uses GTK I thought I would use those. However I can't get any of the following back-ends to work:

GTKAgg (requires python(3)-gtk2)
GTK3AGG (gtk3Agg backend is not known to work on Python 3.x.)
GTK3Cairo (no window opens)
QT4AGG (requires QT4 which is not installed on my system).

I have installed the following packages:

python3 python3-matplotlib ipython3 python3-cairo python3-gi 

I have also tried installing python3-gtk2 but that returns this error:

Package python3-gtk2 is not available, but is referred to by another
package. This may mean that the package is missing, has been
obsoleted, or is only available from another source

Which I'm guessing means that I'm not supposed to use it on Ubuntu 14.04 LTS.

Choosing GTK3Cairo as a backend throws no errors and imports fine using ipython3 and pylabs; but, it also doesn't open a new window when I call the plot() function.

Is there really nothing else that I can use besides tkinter?

Best Answer

I had the same problem on arch. But literally 2mins ago I got qtk4agg to work, I had to delete a sip.so file from inside /usr/lib/python3.5/site-packages/ so that the package was actually installed so set your backend in matplotlibrc to Qt4Agg remove the sip.so file if necessary then install python-pyqt4 and all should be working

Related Question