使用 plt.close() 關閉特定數字
可以通過保持其手柄來關閉特定圖形
import matplotlib.pyplot as plt
fig1 = plt.figure() # create first figure
plt.plot([0, 1], [0, 1])
fig2 = plt.figure() # create second figure
plt.plot([0, 1], [0, 1])
plt.close(fig1) # close first figure although second one is active