import matplotlib.pyplot as plt
fig, ax = plt.subplots(nrows=1, ncols=1)
ax.plot([0, 1, 2], [10, 20, 3])
fig.savefig('path/to/save/image/to.png')
Save plot to image file instead of displaying it using Matplotlib (so it can be used in batch scripts for example)