我更新了我的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))
发布于 2017-07-02 11:55:15
尝试在调用plt.plot()
之后添加plt.show()
。
https://github.com/jupyter-widgets/ipywidgets/issues/1181#issuecomment-284172632
https://stackoverflow.com/questions/44867290
复制相似问题