I have a simulation which calculates surface data for each iteration of the simulation. I would like to continuously plot that data as a surface plot to the same window (upd
I had a similar problem and this worked for me:
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
plt.ion()
fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')
for k in xrange(0,X_range):
ax.plot(x_input, y_input, z_input)
plt.draw()
plt.pause(0.02)
ax.cla()
For you, I'd imagine the solution be something similar to the top answer except replacing time.sleep() with plt.pause(), which would finish the drawing the figure before sleeping.