Set matplotlib backend when testing

The matplotlib backend is not explicitly set when testing, so tests require the user to mess with the default backend settings to run them. Otherwise, figures may pop up or end up in some other format or something depending on the user's settings.