The following code
···
======================
from matplotlib.matlab import *
x = arange(0,20,.2)
y = arange(0,20,.2)
X, Y = meshgrid(x,y)
z=zeros((len(x),len(y)),'f')
for i in enumerate(x):
for j in enumerate(y):
z[i[0]][j[0]]=10*sin(i[1]*j[1])
#or z[i[0],j[0]]=10*sin(i[1]*j[1])
pcolor(X,Y, transpose(z),shading='faceted')
show()
breaks in the module color.py
=============================
def get_color(self, val, valmin, valmax):
# map val to a range
from 0 to 1
if iterable(val):
s = "val must be a scalar.
Perhaps you meant to call get_colors?"
#print val,type(val)
raise ValueError, s
#print valmin, valmax
#print
val,type(val)
ind = self.indmax*(val-valmin)/(valmax-valmin)
return
self.rgbs[self._bound_ind(ind)]
because the test for iterable fails since the element C[i,j] is type
<array>. One solution is to change the code section around line 1126 in
axes.py from c = C[i,j] to the following.
=====================
for i in range(Nx-1):
for j in range(Ny-1):
c = C[i][j]
the form C[i][j] seems to always return float.