Skip to content

k-donn/ec-apportionment

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

88 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages