【发布时间】:2017-05-17 13:50:15
【问题描述】:
如何在 jupyter notebook 中做到这一点:
%matplotlib notebook
import numpy as np
import matplotlib.pyplot as plt
m = 100
n = 100
matrix = np.random.normal(0,1,m*n).reshape(m,n)
fig = plt.figure()
ax = fig.add_subplot(111)
plt.ion()
fig.show()
fig.canvas.draw()
for i in range(0,100):
#ax.clear()
plt.plot(matrix[i,:])
fig.canvas.draw()
但是使用“%matplotlib qt5”而不是“notebook”?
当我尝试它时,它仅在循环结束后显示图形。我希望看到它更新每一个情节。
【问题讨论】:
标签: python matplotlib qt5 jupyter