Python Forum
Automatically updated graph in jupyter notebook using qt5 - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: Data Science (https://python-forum.io/forum-44.html)
+--- Thread: Automatically updated graph in jupyter notebook using qt5 (/thread-3341.html)



Automatically updated graph in jupyter notebook using qt5 - capponero - May-16-2017

Hey guys,

how to do this in 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()
but using "%matplotlib qt5" instead of "notebook"?

When I try it it show the figure only after the loop is ended. I would like to see it updating every plot.