import sys
import matplotlib
+matplotlib.use('Agg') # select backend that doesn't require X Windows
import numpy
import pylab
from scipy.optimize import leastsq
from . import sawsim_histogram
-matplotlib.use('Agg') # select backend that doesn't require X Windows
FIGURE = pylab.figure() # avoid memory problems.
"""`pylab` keeps internal references to all created figures, so share
a single instance.