Eric Firing wrote:

It occurred to me after posting that imshow by default gives a 
misleading picture of the effect of the cmap and boundary norm.  To get 
a clear picture, add the "interpolation='nearest'" kwarg to the imshow call.

Eric

> 
> import numpy as np
> import matplotlib.pyplot as plt
> import matplotlib.colors as mcolors
> import matplotlib.cm as cm
> 
> 
> boundaries = np.linspace(20, 30, 11)
> colors = cm.spectral(np.linspace(0.3, 0.8, 10))
> cmap = mcolors.ListedColormap(colors)
> norm = mcolors.BoundaryNorm(boundaries, cmap.N)
> 
> z = 20 + np.random.rand(10,20)*10
> plt.imshow(z, cmap=cmap, norm=norm)
> plt.colorbar()
> plt.show()
> 

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to