我想创建一个情节,也许放弃它,然后创建另一个情节。
import matplotlib.pyplot as plt
plt.plot(xxx,yyy, ...)
if certain_conditions:
return or otherwise get out of here
plt.show()
...sometime later, someplace far away...
# looking for incantation to make gone of the existing unshown plot
plt.plot(abc,def, ...)
plt.show()
这些代码片段实际上相距甚远,在不同的对象或模块中,无论如何。当第一个情节被放弃时,第二段代码中的 show() 将向我展示超出预期的内容;我只想看看 abc 与 def 的对比。我确定这很简单,但我没有找到它 - 在开始第二个情节之前我想要什么魔法咒语?