NFL Code on Github

I’ve made some revisions and simplifications to the code to compile NFL data. It’s now all out on Github for anyone to play with in advance of the Superbowl. In the meantime, here’s a lovely picture comparing every team’s offense- as measured by total offensive yards- against their defenders.

Note the anemic Chicago offense.

https://github.com/PirateGrunt/NFL

library(ggplot2)
p = ggplot(dfTeamVsTeam, aes(x = as.factor(ThisTeam), y = as.factor(Opponent), fill = ThisTeamTotalYards))
p = p + geom_tile() +  scale_fill_gradient(low="red", high="blue")
p = p + labs(title = "Total yardage", x = "Offense", y = "Defense")
p = p + theme(panel.grid.major = element_blank())
print(p)

TeamVsTeam

About these ads

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 293 other followers

%d bloggers like this: