Styling the map of the United States

Overall, this image is dark, and the borders between the states are not particularly visible. We can change this by providing a style for the fill and stroke values used to render the map.

The code for this example is available at the following link:

Note

bl.ock (12.2): https://goo.gl/chhKjz

When opening this URL, you will see the following map:

Styling the map of the United States

The only change to the previous example is to set the fill to transparent, and the borders to black:

svg.selectAll('path')
   .data(data.features)
   .enter()
   .append('path')
   .attr('d', path)
      .style({ fill: 'none', stroke: 'black' });

Using the albersUsa projection

You may have a ...

Get D3.js By Example now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.