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

时间:2016-03-30 10:49:19

标签: matplotlib plot ipython interactive jupyter

enter image description here我在第一行使用了%matplotlib笔记本的Jupyter笔记本。

制作多个情节时,我必须实际按下“停止互动”。在运行另一个绘图之前,每个图上的按钮,否则最新的绘图将叠加到上一个图上。

我认为问题在于我没有指定每个情节需要制作一个新的数字?但我很难知道如何最好地做到这一点!

我真的要说PLT.FIGURE每一次?这对我来说太不可能了......?

提前致谢!

2 个答案:

答案 0 :(得分:2)

这是笔记本后端的错误,但幸运的是,报告它的人也报告了a workaround

答案 1 :(得分:2)

在Notebook中,您需要在导入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