1

プロットを作成したいのですが、おそらくそれを放棄してから、別のプロットを作成します。

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番目のプロットを開始する前に、どのような魔法の呪文が必要ですか?

4

2 に答える 2

1

単一の図を表示することもできます。

matplotlib1.2.0で

fig1 = plt.figure(1)
fig2 = plt.figure(2)
fig2.show()

2番目の図のみを示しています

于 2013-02-01T22:49:13.757 に答える