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.
Modified http://d3js.org/d3.v3.min.js to a secure url
https://d3js.org/d3.v3.min.js