Drawing maps requires a combination of knowledge and good understanding of GIS, GeoJSON, Projections, and so on as well as techniques and skills for creating the maps. In this section, we will look at a few selected tools that facilitate the generation of interactive maps with D3.
As we discussed in the first section, the colors and color scales that the author chooses can have a huge impact for the reader to perceive the visualization. Therefore, I want to show how we can efficiently create color scales in D3.
Scales can map a certain domain of values to a range of different values using interpolation. We usually use this to create scales for axes. Axes, however, map a domain of values onto a pixel range. In our case, we want to use these scales on colors to map a value domain to a color range. We can achieve this using these color interpolation functions:
d3.interpolateRgb
: RGB and HEX values, such as#00FF00
d3.interpolateHsl
: HSL values...