« Robert Gentleman joins REvolution's board of directors | Main | What programmers should know about Statistics »

January 25, 2010


Feed You can follow this conversation by subscribing to the comment feed for this post.

Yikes, what a misleading colour scale. They should have used equal bin sizes and a three colour scale with white as the middle colour indicating no change.

This map can be improved by making the near-zero values a neutral color, such as white. Also, bins on either side of zero could be given equal sizes in terms of their percentage change. This map looks artificially damning for democrats based on the color and the bin sizes.

Thirding the dishonest scale and key. The other maps lack a neutral colour for neutral ± error.

Agree with comments about the scale. Here is a map that shows the difference in number of votes in each town between Brown and Coakley:

If positive, it is colored red, if negative blue. These are quantiles, and the saturation from white("near neutral") to red or blue increases in even steps. This accounts for more than the conventional town by town analysis of percent win, as it also takes into account relative population size of the towns.

The analysis was done in R, but the map was done with QuantumGIS (open source mapping package) which is quick and easy.

Of note, the maps above are not mapped to a projection and appear distorted. This is an essential step in mapping, and requires some understanding of map projections.

Finally, the shapefile that these maps were made with somehow included water in the town boundaries, making for a very distorted Martha's Vineyard, Cuttyhunk and Woods Hole. They are properly depicted on my map.

Thanks for the post david, and thanks to the commenters for your helpful suggestions. I've reimplemented the 3 maps using some of your suggestions and I believe the output is stronger: http://offensivepolitics.net/blog/?p=275


The colors are better and more accurate to the results. However, the distorted map could be much improved. Try replacing your shp definition with:
shp <- readShapeSpatial('tl_2009_25_cousub', CRS("+proj=longlat +datum=NAD27"))

Also, I think you would be better off using the official US Census MA map, which would clear up the mess at Martha's Vineyard. You can get that here:

You will need to use tolower() and rename the variable from "NAME" to "Town" and edit the data slightly to use it with your data.

The end result will be much improved, I believe.

The comments to this entry are closed.

Search Revolutions Blog

Got comments or suggestions for the blog editor?
Email David Smith.
Follow revodavid on Twitter Follow David on Twitter: @revodavid
Get this blog via email with Blogtrottr