Skip to content

Instantly share code, notes, and snippets.

@gka
Created February 13, 2012 11:23
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gka/1816161 to your computer and use it in GitHub Desktop.
Save gka/1816161 to your computer and use it in GitHub Desktop.
plots all contributions over time, colored by party
# load csv
contr <- read.csv("fec-contr.csv")
# convert date column to R date type
contr$date <- strptime(as.character(contr$contb_receipt_dt), "%Y-%m-%dT%H:%M:%SZ")
plot(date,contb_receipt_amt,axes=F,col=color,cex=.7,ylab="",xlab="",main="Contributions in 2011")
# add time axis
axis(2, las=2, cex.axis=0.65)
axis.POSIXct(1, las=2, at=seq(as.Date("2011/1/1"), as.Date("2012/01/01"), by="month"), cex=0.65, cex.axis=0.65, format="%b")
# add labels for biggest contribution
m = subset(contr, contb_receipt_amt > 250000)
text(m$date, m$contb_receipt_amt, m$contbr_nm, cex=.65, pos=2)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment