I am trying to plot some data from a camera dynamically using drawnow. However, the dynamic plotting (using matplotlib and drawnow) doesn't seem to be working on jupyter notebook.
It's currently working in Pycharm.
My code:
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)
I would expect this example to plot 10 points dynamically on the same figure (as in pycharm). What actually happens is that multiple figures appear rather than one.
Any thoughts why I am not able to do it using jupyter notebook?