I am writing a quick-and-dirty script to generate plots on the fly. I am using the code below (from Matplotlib documentation) as a starting point:
from pylab
When using matplotlib.pyplot, you must first save your plot and then close it using these 2 lines:
matplotlib.pyplot
fig.savefig('plot.png') # save the plot, place the path you want to save the figure in quotation plt.close(fig) # close the figure window