【发布时间】:2016-08-08 19:31:48
【问题描述】:
在以下几行中,我报告了一个代码,该代码在 Anaconda Spyder 上使用 Python 生成随时间变化的图
import matplotlib.pyplot as plt
import numpy as np
x = np.arange(-3, 3, 0.01)
N = 1
fig = plt.figure()
ax = fig.add_subplot(111)
for N in range(8):
y = np.sin(np.pi*x*N)
line, = ax.plot(x, y)
plt.draw()
plt.pause(0.5)
line.remove()
我想用 Jupyter 做一些事情,但这是不可能的。特别是 Jupyter 上似乎不存在 Matplotlib 方法 .pause() 。 有没有人可以解释一下这种差异,并可以帮助我为 Jupyter 上的 Python 随时间变化的图构建代码?
【问题讨论】:
标签: python matplotlib spyder jupyter