Skip to content


Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time
December 13, 2020 13:02
December 13, 2020 13:02
November 28, 2020 10:26
December 12, 2020 17:17
December 12, 2020 17:17

Redrawing the States

This visualization was an attempt by me to:

  1. Understand d3 (one day I should really learn it. :) ), and
  2. More importantly, to understand just how janky the electoral college is.

Using this visualization, you can move counties to other states. Currently it's a bit difficult to use, but what I found, basically, is that

  • If you move the three westernmost counties of the Florida panhandle to Alabama, Florida flips to Clinton,
  • If you move the 10 closest counties of the Upper Peninsula of Michigan to Wisconsin, Michigan flips to Clinton,
  • If you move the three closest counties of California to Arizona, Arizona flips to Clinton,
  • If you move Cook County from Illinois to Indiana, Indiana flips to Clinton (and gains 7 electoral votes), and Illinois flips to Trump (and loses 7 electoral votes),
  • If you move Lake County (just above Chicago) to Wisconsin and those 10 counties of the UP to Wisconsin, Clinton wins Illinois, Wisconsin, and Michigan,
  • If Camden joined Pennsylvania, Clinton wins both Pennsylvania and New Jersey (and no electoral votes change hands),

In total, if only 8 counties move (3 from CA -> AZ, Camden -> PA, Lake -> WI, 3 from FL -> AL), Clinton wins 301 to 237.


If you want to try to make sense of the current draft product, then just run

cd public && python3 -m http.server

and then point your browser to localhost:8080/map.html. Or, if you want, go here for the latest live version.

Grabbing data

To grab data and structure it for production, you will need to have both Python 3.8 or above installed as well as node 12 or above. After that, you'll need to install dependencies with:

poetry install
npm install

After that, you can create the 2016 and 2020 data sets by running:

poetry run redraw 2016 public/data/us.json
poetry run redraw 2020 public/data/us2020.json

If you'd like to recreate the 2012, 2008, and 2004 files, you need to grab the data set at::

Supposed you saved it as countypres_2000-2016.csv. Then you would run the commands:

poetry run redraw mit 2012 countypres_2000-2016.csv public/data/us2012.json
poetry run redraw mit 2008 countypres_2000-2016.csv public/data/us2008.json
poetry run redraw mit 2004 countypres_2000-2016.csv public/data/us2004.json

Unfortunately, at this time, the Census Bureau's API for 1990 SF1 data seems to be down, and so we cannot create a file for the year 2000. :-/


I ganked a lot of stuff from the interwebs to make this. Here is a list:

  • Mike Bostock's tutorial on how to make a bubble map underlies a lot of the shape data: link
  •'s election data by county was used in the original 2016 tool
  • In 2020 I moved to the New York Times' data for 2020 and 2016
  • Population and income data come from the Census Bureau's decennial SF1 file
  • D3 Tooltips from Lee Howorko here
  • Colors for the map from FiveThirtyEight's's election coverage
  • Lines in the middle of divs from this StackOverflow
  • getParameterByName function from this StackOverflow
  • The copy-paste examples from clipboard.js are copied verbatim
  • Bootstrap, D3, and jQuery are, of course, indispensable
  • css-element-queries from @marcj were super useful for zooming in the previous version of this tool


Kevin Wilson (the owner of the repo) is the main contributor. But some others have helped as well. Notably:

  • @herbiemarkwort contributed the "0 population => 0 electors" computation
  • @Euonia contributed the keyboard shortcut for going to "Move" mode


GPL v3


A small visualization to see how stupid the Electoral College is






No releases published


No packages published