Thursday, February 4, 2010

Logarithmic Colormap / Other Colormap in Matplotlib

This is kind of a pain to find out:

from matplotlib.colors import LogNorm

im = imshow(.... cmap=... , norm=LogNorm(vmin=clevs[0], vmax=clevs[-1]))

It also works for contours, and can be particularly useful if you only want to display contours at a few levels, but you want the colormap to start at a different point. e.g.:


will start at light blue instead of dark blue in the default colormap

No comments: