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=/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
verbose.level 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?

Update:
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()

      

+3


source to share


1 answer


On import, pyplot

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 startupplt.get_backend()

To install the backend, you must run these commands before importing pyplot

:

import matplotlib
matplotlib.use(your_backend)

      

Where



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 ~/.matplotlib/matplotlibrc

, like this example:

backend       : WXAgg

      

+3


source







All Articles