Set matplotlib to Agg backend

This is an alternative to f2744344 that uses the Agg backend rather than setting up Travis to use X11, which seems like overkill.