All examples By author By category About


Declining Share of Manufacturing Jobs

Share of jobs in manufacturing by commuter area from 1990 to the 2016. Hover to isolate an individual commuter area's series. Data are not seasonally-adjusted.

To keep the size of this graphic down I shrunk each faceted chart based on it's max y-value while keeping the y-scale consistent across charts. At first I just let the browser float each chart in a container but this left weird gaps between charts. Looked into it and found that fitting irregular shapes into other shapes neatly is called the bin packing problem. I implemented a 2D rectangular bin packing algorithm in JavaScript based on Jukka Jylanki's C++ implementation of the algorithm. This let me lay the charts out snugly.

This bin packing implementation can be found in this GitHub repository: BinPack. The API is still a bit rough at the moment.

Data come from the Bureau of Labor Statistics. The shell script in this gist repository shows how to download the data in bulk. The clean-data.R R script shows how the data was prepped for the visualization. The little state icons are from ProPublica's StateFace project.