All examples By author By category About

emeeks

Napoleon's March with d3.svg.ribbon

An example of d3.svg.ribbon using Napoleon's March through Russia made famous by Minard's map. Dataset comes from Ben Schmidt's use of it in his excellent d3.trail layout.

The pattern for using d3.svg.ribbon with geodata is simply to factor the projection into the accessors:

projection = d3.geo.equirectangular().translate([-3300,7800]).scale(8000);
sizeScale = d3.scale.linear().domain([6000,340000]).range([1,10])

ribbon = d3.svg.ribbon()
  .x(function(d) {return projection([d.lon, d.lat])[0]})
  .y(function(d) {return projection([d.lon, d.lat])[1]})
  .r(function(d) {return sizeScale(d.size)});