I want to show a figure that is calculated in a loop, let say with 5 iterations.
This is the code that I wrote
import numpy as np
import matplotlib.pyplot as plt
x = np.linspace(0,1,100)
y = np.linspace(0,1,100)
xx,yy = np.meshgrid(x,y)
for n in range(5):
a = np.sin(xx-2*n)
plt.imshow(a,interpolation='bilinear')
plt.show()
With this code, I got 5 figures. How to make it runs in one figure like an animation? I used google collab, is it possible to make the result (figure) opened in new window (undocked) like in matlab?
New contributor
Margi is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.