This is an example from my blog on Creating a smooth color legend with an SVG gradient. The color legend below is just a simple rectangle filled with an SVG gradient. But in for this particular data it works well, because you are mostly interested in trends, to get a general sense of then numbers. Therefore, it is not imperative to be able to read the exact value that each color represents. And in those cases, when you work with a quantitative color scale, I prefer to use smooth color legends.
The map you see is the visual output from a Machine Learning Technique to cluster data called Self-Organizing Maps. If you want to learn more about this fabolous technique, see my SOM blog series
You can other SVG legend gradient examples here:
https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.6/d3.min.js