【发布时间】:2018-05-01 01:24:53
【问题描述】:
我正在尝试使用drawow动态绘制来自相机的一些数据。但是,动态绘图(使用 matplotlib 和 drawow)似乎不适用于 jupyter notebook。
目前在 Pycharm 中运行。
我的代码:
import matplotlib.pyplot as plt
import numpy as np
from drawnow import *
x = np.random.randn(10, 2)
def function_to_draw_figure():
plt.plot(i, j, 'r.')
plt.ion()
figure()
for i, j in x:
drawnow(function_to_draw_figure)
plt.xlim(-1, 1)
plt.ylim(-1, 1)
plt.pause(0.5)
我希望这个例子在同一个图上动态地绘制 10 个点(就像在 pycharm 中一样)。实际发生的是出现多个数字而不是一个。
有什么想法为什么我无法使用 jupyter notebook 做到这一点?
【问题讨论】:
标签: python python-3.x matplotlib jupyter-notebook