Updating a 3D graph every n minutes in Python
<p>I have the following code to plot a 3D graph in Python</p>

<pre><code>data = # taken from an SQL query in (x, y, z) format #

x, y, z = zip(*data)
z = map(float, z)
grid_x, grid_y = np.mgrid[min(x):max(x):100j, min(y):max(y):100j]
grid_z = griddata((x, y), z, (grid_x, grid_y), method='cubic')

fig = plt.figure()
ax = fig.gca(projection='3d')
ax.plot_surface(grid_x, grid_y, grid_z, cmap=plt.cm.Spectral)
plt.show()
</code></pre>

<p>I want the plot to be undated every 1 minute. I can get the data from the table using a thread every 1 minute but I am unable to update the plot. </p>

<p>Can you help me with a suggestion?</p>

<p>Thanks in advance!</p>

<p>After some research I found a way of doing this with matplotlib.animation.</p>

<p>The below Youtube link was of great help.</p>

<p><a href="https://www.youtube.com/watch?v=7w8jk0r4lxA" rel="nofollow">https://www.youtube.com/watch?v=7w8jk0r4lxA</a></p>

python matplotlib plot