my_cmap = matplotlib.cm.get_cmap('rainbow')
my_cmap.set_under('w')
imshow(np.arange(25).reshape(5, 5), interpolation='none', cmap=my_cmap,
    vmin=0.001)
How to manually change a colormap in python/matplotlib