[SciPy-user] [*] Re: Restricting the values to be plotted while usingcontourf

Whitcomb, Mr. Tim tim.whitcomb@nrlmry.navy....
Mon May 4 12:18:52 CDT 2009


> > We did this by creating a new instance of 
> matplotlib.colors.Normalize 
> > that restricted the range: something like contourf(X, Y, Z, 
> > norm=matplotlib.colors(Normalize(vmin=0, vmax=100)).
>     Your method does not seem to work. I keep getting the 
> following error:
>    
> contourf(A, B, z, 100, extend='both',
> norm=matplotlib.colors(Normalize(vmin=0, vmax=100) ) )
> TypeError: 'module' object is not callable

No surprise there - I typed it in wrong: it should be
contourf(A, B, z, 100, extend='both',
norm=matplotlib.colors.Normalize(vmin=0,vmax=100))

As I understand it, contourf uses a normalizer to map your values to
[0,1] then applies the colormap.  You're simply replacing the default
with a new instance of Normalize that handles a specific range.

Tim


More information about the SciPy-user mailing list