k-donn / ec-apportionment

Based on CGP Grey's Electoral College spreadsheet

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Electoral College Apportionment

A Matplotlib representation of CGP Grey's Electoral College spreadsheet. This animates the number of representatives, people to representative ratio, and priority number calculations.

See Running for instructions on how to get started

Usage

usage: python source/bar_chart.py [-h] -f FILE [-d]

Show an animation of the Huntington–Hill apportionment method

optional arguments:
  -h, --help            show this help message and exit
  -f FILE, --file FILE  Path to CSV state population data
  -d, --debug           Show the plot instead of writing to file

Example

Example GIF

Running

  • Create conda env from environment.yml (see Install Conda)
  • From the root of the folder,
python ./source/bar_chart.py -f ./data/state-populations.csv
  • The resulting video is put into ./recordings
  • If there are any errors, they are most likely backend related.

Meta

From this video.

Update/Change the state population data by putting your own data into state-populations.csv or pass the new name of the file from the command line.

The CSV file should not have a header.

About

Based on CGP Grey's Electoral College spreadsheet

License:MIT License


Languages

Language:Python 100.0%