Hello,
I’m having trouble scaling the z-values for a filled contour plot. I would like to produce a series of plots like:
plot.contourf(x, y, z, 20, cmap=matplotlib.cm.RdBu_r)
but I would like there to be an absolute correspondence between a given z-value and a given color in the colormap no matter what the range of z-values for a particular plot. I thought the way to do this would be to use the norm keyword like:
normFunction = matplotlib.colors.normalize(vmin=minValue, maxValue)
plot.contourf(x, y, z, 20, norm=normFunction, cmap=matplotlib.cm.RdBu_r)
but this gives the error:
File “/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/matplotlib/axes.py”, line 4054, in contourf
return ContourSet(self, *args, **kwargs)
File “/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/matplotlib/contour.py”, line 456, in init
for level, level_upper, color in zip(lowers, uppers, self.tcolors):
AttributeError: ContourSet instance has no attribute ‘tcolors’
Any suggestions?
Thanks,
Mike