#Import these lines before importing pyplot import matplotlib as mpl mpl.rcParams['agg.path.chunksize'] = 10000