Closing Matplotlib figures Back To close a figure in matplotlib use plt.close(fig) or plt.close('all'). In jupyter keeping the figure alive will consume memory