In case you're curious, here's the shell script and
R code that I used to generate the above plot:
#!/bin/bash# Generate all-states polling chart from electoral-vote.com data
# Tom Moertel <tom@moertel.com>
# 2004-11-02# configCSV=allpolls.csv
FILEBASE=polls-by-state
GS="gs -dSAFTER -dBATCH -dNOPAUSE"# set up filenamesEPS=$FILEBASE.eps
PNG=$FILEBASE.png
PDF=$FILEBASE.pdf# get polling data and add header to itecho "Making sure we have polling data (delete $CSV to force download) ..."[ -f $CSV ] ||
( echo -n date,series,state,ev,kerry,bush,nader,released,
echo unk2,unk3,unk4,unk5,unk6,unk7,unk8,source
GET http://www.electoral-vote.com/info/$CSV
) > $CSV# use R to generate plot in Postscript format
# (uses X11 window so we can see the plot in passing)echo Generating plots ...R --no-save --no-init-file --no-restore-data <<EOF polls <- read.csv("$CSV")
require("lattice")
trellis.device(x11, theme=col.whitebg())
p <- xyplot(kerry + bush ~ date | state, data=polls,
main="Polling Numbers by State (Nov 2)",
auto.key=list(rectangles=F,x=.75,y=.875,corner=c(1,1)),
xlab="Elapsed days (1 = Sep 1)",
ylab="Percentage who would vote for candidate")
p
dev.copy2eps(file="$EPS",family="Helvetica-Narrow")EOF# create other graphics formatsecho Rasterizing into PNG format ...$GS -sDEVICE=pngalpha -dBackgroundColor='16#ffeebb' -dEPSCrop \
-sOutputFile=$PNG $EPSecho Converting into PDF version ...ps2pdf -dEPSCrop $SIZEPARMS $EPS# done!echo Done!