プロットを作成したいのですが、おそらくそれを放棄してから、別のプロットを作成します。
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()
これらのコードの断片は、オブジェクトやモジュールが異なるなど、実際には大きく離れています。最初のプロットが破棄されると、コードの 2 番目のチャンクの show() は、必要以上のものを表示します。abc と def のグラフを表示したいだけです。これは簡単だと思いますが、見つけられません.2番目のプロットを開始する前に、どのような魔法の呪文が必要ですか?