|
From: Eric F. <ef...@ha...> - 2012-07-29 16:31:32
|
On 2012/07/29 5:13 AM, Jeffrey Spencer wrote: > Eric, > > Normalize appears to be working correctly and as you stated above but > when passed into contourf appears to have inconsistent results not > following the docstring by allowing the value to change. > > Quick examples: > > X, Y = meshgrid(arange(20),arange(20)) > Z = arange(20*20) > Z = Z.reshape(20,20) > norm = colors.Normalize(vmin=200,vmax=None) > print norm.vmin > fig = figure(10) > ax = fig.add_subplot(111) > surf = ax.contourf(X,Y,Z, 100, cmap=matplotlib.cm.jet, norm = norm) > > This vmin has no effect where if you pass in: > > X, Y = meshgrid(arange(20),arange(20)) > Z = arange(20*20) > Z = Z.reshape(20,20) > norm = colors.Normalize(vmin=200,vmax=Z.max()) > print norm.vmin > fig = figure(10) > ax = fig.add_subplot(111) > surf = ax.contourf(X,Y,Z, 100, cmap=matplotlib.cm.jet, norm = norm) > > it has the desired effect. > > Let me know if this is correct or I'm missing something here. > > Cheers, > Jeff You are correct. Contour and contourf are respecting vmin, vmax that have been set in the norm only if both have been set, so that it is fully scaled. I think that changing this to respect a single preset vmin or vmax would be reasonable. Eric |