Original idea by FiveThirtyEight (data viz & data)

Source code available here

Python code to process the original data available here