Congressional ideology by state

In a recent post, I illustrated how to add a background geom to your ggplot. While that code worked, and the plot looked fine, it was pointed out to me that I was missing an important aspect of plot layering with ggplot2. Namely, it is not, as I previously claimed, necessary to add extra NULL variables to the background data.frame.

Fortunately, I was put on the right path by the inimitable Hadley Wickham, who pointed out that There is, of course, a Function for That: mutate()

This Gist correctly builds a layered plot, shows how mutate() works, and plots DW-NOMINATE House ideology in two-dimensions, by state, with an illustration of what I consider a very useful visualization technique — adding a reference distribution to each plot facet.

By d-sparks

Tags: rstats foreign ggplot2 plyr graphics