我不知道如何制作一个新的 matplotlib 图

I don't know how to make a new matplotlib figure

我在第一行中使用 Jupyter notebook 和 %matplotlib notebook

制作多个绘图时,我必须在 运行 另一个绘图之前实际按下每个图形上的 'stop interaction' 按钮,否则最新的绘图将覆盖在前一个图形上。

我认为问题是我没有指定需要为每个地块制作一个新图形?但我不知道如何最好地做到这一点!

我真的必须每次都说 PLT.FIGURE 吗?这对我来说似乎不太可能...?

提前致谢!

这是 notebook 后端的一个 bug,幸好报告的人也报告了 a workaround

在笔记本中,您需要在导入 pyplot 后添加 plt.ioff。

这是从笔记本顶部截取的一个片段,适合我使用。我和你一样被重写了。

%matplotlib notebook   # this is to allow the plotting in the notebook

import numpy as np
from scipy.linalg import hadamard
import matplotlib.pyplot as plt

plt.ioff()    # this stops the graphs from overwriting each other