Fix matplotlib tests on Travis

Matplotlib doesn't work out of the box on Travis because there is no `$DISPLAY` variable (well, there's no graphics in general) and the default backend is `QtAgg`. This PR is to get that working so the unittests can cover the plotting functions too.