Last week, I needed to add many axes to a single D3 svg. I had a set of sets of data points, and I wanted each of these sets of data to be rendered with its own x and y axes. To do this, I wrote the following: var locationArea = bar.append("g") .attr("transform", function(d) { return "translate(200," + 24*(+d.length) + ")"; }) .attr("class", function(d, i) { return "locations n_".concat(i) }); var locationXAxes = locationArea .each(function (d, i) { var lat_scale = d3.scale.linear() .range([-...