matplotlib sin gui

import matplotlib as mpl
mpl.use('Agg')
import matplotlib.pyplot as plt
Gifted Gull