ipywidgets jupyter 笔记本

ipywidgets jupyter notebook

我更新了我的 Anaconda 版本,当我尝试在 Jupyter notebook 中使用 ipywidgets 时,我得到了几个图形而不是交互式图形:

%matplotlib inline
from matplotlib import pyplot as plt
import numpy as np

from ipywidgets import interact

def pinta(freq):
    x = np.linspace(0,3,200)
    y = x * np.sin(freq * x)

    plt.plot(x,y,'r')

interact(pinta, freq= (2 * np.pi, 2 * np.pi *10))

尝试在调用 plt.plot() 后添加 plt.show()

https://github.com/jupyter-widgets/ipywidgets/issues/1181#issuecomment-284172632