a = np.arange(0,100,1).reshape(10,10) cmap = mpl.colors.ListedColormap(['r','gold','limegreen','darkturquoise','indigo']) cmap.set_under('silver') cmap.set_over('silver') bounds = [10, 20, 30, 50, 70, 90] norm = mpl.colors.BoundaryNorm(bounds, cmap.N) vmin, vmax = min(bounds), max(bounds) plt.imshow(a, cmap=cmap, norm=norm, interpolation='nearest', vmin=vmin, vmax=vmax) plt.colorbar(extend='both') plt.show()