Plot dynamically changing graph using matplotlib in Jupyter Notebook
<p>I have a M x N 2D array: ith row represents that value of N points at time i. </p>

<p>I want to visualize the points [1 row of the array] in the form of a graph where the values get updated after a small interval. Thus the graph shows 1 row at a time, then update the values to next row, so on and so forth. </p>

<p>I want to do this in a jupyter notebook. Looking for reference codes. </p>

<p>I tried following things but no success:</p>

<p><a href="http://community.plot.ly/t/updating-graph-with-new-data-every-100-ms-or-so/812" rel="nofollow">http://community.plot.ly/t/updating-graph-with-new-data-every-100-ms-or-so/812</a></p>

<p><a href="https://pythonprogramming.net/live-graphs-matplotlib-tutorial/" rel="nofollow">https://pythonprogramming.net/live-graphs-matplotlib-tutorial/</a></p>

<p><a href="http://stackoverflow.com/questions/5618620/create-dynamic-updated-graph-with-python">Create dynamic updated graph with Python</a></p>

<p><a href="http://stackoverflow.com/questions/11371255/update-lines-in-matplotlib">Update Lines in matplotlib</a></p>

<p>Here's an alternative, possibly simpler solution:</p>

<pre><code>%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()
    ax.plot(matrix[i,:])
    fig.canvas.draw()
</code></pre>

python matplotlib plot graph jupyter-notebook