# Best colormap for Matlab/Matplotlib plots

Much has been written on
selecting best colormaps
from among: sequential, divergingm and qualitative.
**Sequential** colormaps are good for representing magnitude of data.
How much flow, how much precipitation, how much weight, temperature, etc.
Having a monotonic
lightness factor
is important for perceptual consistency.
Non-linear lightness is used to emphasize certain ranges of data, perhaps where snow changes to ice or rain.
Non-monotonic lightness can be used to emphasize different types of precipitation or phase changes, etc.
Example sparse data plots with reversed sequential colormaps: colormap_white_min.py, colormap_white_min.m

Reversed sequential colormaps are useful for sparse data such as astronomical images or precipitation data where a lot of data is at or near zero relative to other data.
The reversal leads to near-zero areas being white and higher intensities being darker.
While any colormap can be reversed, typically sequential colormaps are used with/without reversal.
Matplotlib colormaps are reversed by appending `_r`

to the colormap name.
For example:

`cmap='cubehelix_r'`

Matlab and GNU Octave colormaps are reversed by `flipud()`

the colormap.
Colormaps in `.m`

code are represented as an (N,3) array, where N is the number of steps in the colormap (typically 64 or 256).

`colormap(flipud(cubehelix()))`

Matlab cubehelix.m is like Matplotlib.

**Diverging** colormaps are useful for positive or negative data where the sign is as important as the magnitude.
For example, in/out flows, positive/negative charge.
These colormaps are white near the zero point (which can be offset) and intensify as their absolute magnitude increases.

**Qualitative** colormaps emphasize difference between values, but without a particular sense of ordering.
This can be useful for categories, say a histogram of salary vs. employee type.