Matplotlib stopped working after updating to 1.1.0
I am trying to run matplotlib 1.1.0 under Ubuntu 11.10. I had previously installed and working matplotlib 1.0.1, but I needed some features from version 1.1.0 (and it got very annoying that all the documentation was for a different version than mine), so I decided to update.
Now I cannot show any graphs.
I removed everything I had from the package repository and installed version 1.1.0 from source . I read the installation FAQ , but the tips there didn't help. I am getting the following output from their suggested troubleshooting procedure, but there is no graph:
/home/tomas CONFIGDIR=/home/tomas/.matplotlib matplotlib data path /usr/local/lib/python2.7/dist-packages/matplotlib/mpl-data loaded rc file /usr/local/lib/python2.7/dist-packages/matplotlib/mpl-data/matplotlibrc matplotlib version 1.1.0 helpful interactive is False platform is linux2 Using fontManager instance from /home/tomas/.matplotlib/fontList.cache backend agg version v2.2=
What do I need to do to make this work?
After looking at some of the troubleshooting tips in the comments, I can report that this is the actual display of the graphs not working.
Executing the following script outputs a png with the expected graph, but does not show any plot window.
from matplotlib import pyplot as plt plt.plot([1, 2, 3]) plt.savefig('testfig.png') plt.show()
source to share
it has to set the backend, and it can set it to non-interactive, which explains the behavior you are seeing. See which backend is used at startup
To install the backend, you must run these commands before importing
import matplotlib matplotlib.use(your_backend)
your_backend in set(["FLTKAgg", "GTK", "GTKAgg", "GTKCairo", "macosx", "QTAgg", "QT4Agg", "TkAgg", "WX", "WXAgg"])
To make this a permanent parameter, put the backend name (without quotes) in your file
, like this example:
backend : WXAgg
source to share