This example shows a rainbow scale and its decomposition in the Hue-Chroma-Lightness color space (aka HCL or CIELCH).
The HCL decomposition clearly shows that lightness and chroma are not constant, and change in a non-linear, erratic fashion, making this scale a bad choice for encoding linear or categorical data.
For more details, see also this example on HCL and this analysis of a rainbow color scale by Mike Bostock.