Improve performance of parse.py over ssh

* Use Agg backend

* Requires non-global matplotlib.pyplot imports to be able to change backend