Updating matplotlib plot during code execution
<p>I have found that the latest update to python/matplotlib has broken a crucial feature, namely, the ability to regularly update or "refresh" a matplotlib plot during code execution. Below is a minimally (non-)working example.</p>

<pre><code>import numpy as np
from matplotlib.pyplot import *
from time import sleep

x = np.array([0])
y = np.array([0])

figure()
for i in range(51):
    gca().cla()
    plot(x,y)
    xlim([0,50])
    ylim([0,2500])
    draw()
    show(block = False)
    x = np.append(x,[x[-1]+1])
    y = np.append(y,[x[-1]**2])
    sleep(0.01)
</code></pre>

<p>If I run this program using Python 3.4.3 and matplotlib 1.4.3, I can see the plot continually update, and the curve grows as the program runs. However, using Python 3.5.1 with matplotlib 1.5.3, the matplotlib window opens but does not show the plot. Instead, it continually shows the window is "not responding" and only presents the final plot when the code finishes executing.</p>

<p>What can I do about this? Is there some way to achieve the functionality that I want using the latest release?</p>

<p>Note: I'm running this from the default IDLE environment if that makes a difference.</p>

<p>That is interesting. I'm used to draw interactive plots a little bit differently: </p>

<pre><code>import numpy as np
import matplotlib.pyplot as plt
from time import sleep

x = np.array([0])
y = np.array([0])

plt.ion()
fig = plt.figure()
ax=fig.add_subplot(111)
ax.set_xlim([0,50])
ax.set_ylim([0,2500])
line,  = ax.plot(x,y)
plt.show()
for i in range(51):
    x = np.append(x,[x[-1]+1])
    y = np.append(y,[x[-1]**2])
    line.set_data(x,y)
    plt.draw()
    sleep(0.01)
</code></pre>

<p>Can you (or anyone) check if this shows the same problems in Matplotlib 1.5?</p>

python matplotlib plot