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().