pcolor を使用して 2D 配列から情報をプロットします。ただし、配列内の情報は反復中に変更されるため、変更をリアルタイムで視覚化するために、カラーマップを動的に更新したいと考えています。最も簡単な方法でそれを行うにはどうすればよいですか?
編集 - 例:
from __future__ import division
from pylab import *
import random
n = 50 # number of iterations
x = arange(0, 10, 0.1)
y = arange(0, 10, 0.1)
T = zeros([100,100]) # 10/0.1 = 100
X,Y = meshgrid(x, y)
"""initial conditions"""
for x in range(100):
for y in range(100):
T[x][y] = random.random()
pcolor(X, Y, T, cmap=cm.hot, vmax=abs(T).max(), vmin=0)
colorbar()
axis([0,10,0,10])
show() # colormap of the initial array
"""main loop"""
for i in range(n):
for x in range(100):
for y in range(100):
T[x][y] += 0.1 # here i do some calculations, the details are not important
# here I want to update the color map with the new array (T)
ありがとう