Here I have made a simple program, which populate a 2-D mesh by taking values from a matrix(NxN) 'config' which has random values from (-1 to 1). I want this plot to be animated so that when I update these values in Matrix the plots gets updated. I have seen few animation codes ,but the are not what I am looking. Can someone point me to right direction. Thank You.
import numpy as np
from numpy.random import rand
import matplotlib.pyplot as plt
import matplotlib.animation as animation
f = plt.figure(figsize=(15, 15), dpi=80);
N=10
n_=1
i=1
config = 2*np.random.uniform(2, size=(N,N))-3
print(config)
X, Y = np.meshgrid(range(N), range(N))
#print(X)
plt.pcolormesh(X, Y, config, cmap=plt.cm.RdBu);
plt.title('Time=%d' % i);
plt.axis('tight')
plt.show()
We can make a new matrix/tensor "animate_grid" with (TxNxN), i.e. NxN matrix of updated value(any values even random) for each time step T. example
T=0
[[-0.244608 -0.71395497 -0.36534627]
[-0.44626849 -0.82385746 -0.74654582]
[ 0.38240205 -0.58970239 0.67858516]]
T=1
[[-0.46084 -0.3413957 -0.3453345627]
[-0.43626849 -0.6385746 -0.4654582]
[ 0.8240205 -0.8970239 0.37858516]]
T=2
[[-0.4546084 -0.9565497 -0.534627]
[-0.2546849 -0.8345746 -0.465654582]
[ 0.4460205 -0.4660239 0.6858516]]
etc. etc.
