Hey everyone, I’m struggling with matplotlib on Ubuntu 10.04 and Python 2.6.5. I’m trying to set up the backend, but I keep running into issues. Here’s what I’ve tried:
import matplotlib
matplotlib.use('TkAgg')
import matplotlib.pyplot as plt
plt.figure()
plt.plot([4, 5, 6])
plt.show()
When I run this, I get an error saying the backend doesn’t support show()
. I’ve installed some packages like libagg
and python-gtk2-dev
, and tried different backends like ‘GTK’ and ‘TkAgg’, but no luck.
Can anyone help me figure out which backend I should use and what libraries I need to install? I’m really stuck and would appreciate any advice on getting matplotlib to work properly. Thanks!
It seems you’re encountering a common issue with matplotlib backends on Ubuntu. Given your setup, I’d recommend trying the ‘Qt4Agg’ backend. First, ensure you have the necessary dependencies installed:
sudo apt-get install python-qt4 libqt4-dev
Then, modify your code to use Qt4Agg:
import matplotlib
matplotlib.use(‘Qt4Agg’)
import matplotlib.pyplot as plt
plt.figure()
plt.plot([4, 5, 6])
plt.show()
If this doesn’t work, consider updating your Python and matplotlib versions. Ubuntu 10.04 is quite dated, and newer versions might resolve your backend issues. Alternatively, you could use a virtual environment with updated packages to avoid system-wide changes.
yo spinninggalaxy, sucks ur havin issues. have u considerd using ‘Agg’ backend? its non-interactive but works w/o extra deps. just do matplotlib.use(‘Agg’) then save ur plot to file insted of plt.show(). might be easiest solution for now
hey, have u tried qt4agg? works well on ubuntu sometimes. check u have all deps installed, like python-qt4. wonder if any other backend worked for u? what have u tried so far?