This is the code for Chapter 10, Figure 4 from D3.js in Action that shows the effect on the position of elements from changing to .size() function of d3.layout.grid().
Modified http://d3js.org/colorbrewer.v1.min.js to a secure url
https://d3js.org/colorbrewer.v1.min.js
https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.5/d3.min.js