刷新matplotlib中的所有当前数字

时间:2012-11-01 09:25:44

标签: python matplotlib

说我做了

figure(1)
plot(...)
figure(2)
plot(...)

我想创建第三个数字,只显示那一个。这样:

figure(1)
plot(...)
figure(2)
plot(...)
somemagicFuncToFlushFigures()
figure(3)
plot(...)
show()

只会显示第三个数字。 我该怎么做?

1 个答案:

答案 0 :(得分:12)

你想关闭数字吗?我想知道以下是否有帮助?

import matplotlib.pyplot as plt
plt.close()

<强>更新: 正如@jorgeca所说,要关闭所有数字,请尝试使用plt.close('all')