Skip to content

Instantly share code, notes, and snippets.

@aflaxman
Created October 26, 2010 02:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aflaxman/646237 to your computer and use it in GitHub Desktop.
Save aflaxman/646237 to your computer and use it in GitHub Desktop.
""" Script to remake some uncommunicative info graphics I've seen in the news"""
from pylab import *
# Eli Sander's article "Tax the Filthy Rich"
# http://www.thestranger.com/seattle/tax-the-filthy-rich/Content?oid=4837455
# http://www.thestranger.com/binary/8563/feature2.jpg
y = [2116.906, 787.162, 356.570, 72.858]
y2 = [38.400]
figure(1)
clf()
bar([1,2,3,4], y, color='grey', label='Not Taxed')
bar([4], y2, color='red', label='Taxed')
axis([.5, 5, 0, 2500])
xticks([1.4, 2.4, 3.4, 4.4], ['Under $50K', '$50K-100K', '$100K-200K', 'Over $200K'], ha='center')
legend()
ylabel('WA Tax Returns (Thousands)')
# NYTimes Chamber of commerce
# http://www.nytimes.com/2010/10/22/us/politics/22chamber.html
# http://www.nytimes.com/imagepages/2010/10/22/us/politics/22chamber-g.html
r = [34.3, 21.1, 15.3, 12.9, 8.7, 8.5, 8.0]
rnames = 'NRCC USCC AAN AC AFF NRSC AJS'.split()
d = [26.3, 22.0, 10.6]
dnames = 'DCCC DSCC SEIU'.split()
figure(2)
clf()
bar(1 + zeros_like(r), cumsum(r)[::-1], color='red')
bar(2 + zeros_like(d), cumsum(d)[::-1], color='blue')
for i in range(len(r)):
text(1.4, cumsum(r)[i], '\n%s'%rnames[i], va='top', ha='center')
for i in range(len(d)):
text(2.4, cumsum(d)[i], '\n%s'%dnames[i], va='top', ha='center')
xticks([1.4, 2.4], ['Are/Lean Conservative', 'Are/Lean Liberal'])
axis([.8, 3, 0, 125])
ylabel('Campaign Spending (millions)')
title('Top Ten Campaign Spenders Jan 1, 2009 to Oct 18, 2010')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment