Swing States Visualization

Some weeks ago Robert Kosara posted in his EagerEyes a visualization made with Tableau with the intent to understand the swing states in the US elections. His post generated quite a lot of reactions. Many people tried to propose alternative designs and suggested potential improvements. After few days, I tried to create my own interactive version and here is the result I have put together so far.
The original data provided by Robert contains for each pair of year and state, the winning party. I have added to this data the information about who was the president elected and the winning party.
Here is a screenshot.
Click on this link to launch the applet (on a new window).

Visualization Design

The visualization is a simple interactive matrix where the rows represent the states and the columns the years. Since the focus of the visualization is to see which states swing, graphical marks are added only when they in fact swing, and the color is the one of the winning party (I originally used a slightly different design where a shade of colors from the previous to the actual winner was used, but the result was too noisy). On the top of the visualization an additional row is used to depict which party was finally the winner in the elections. In this way it is possible to see which states where determinant for the final result.
The visualization has some few interactive features. Hovering is used to focus on a specific row-column pair and to dynamically show which presidents was elected in a given year. On the bottom there are some few filtering tools:

  • From/To: to focus on specific swings from one party to another.
  • #Swings: to filter out the states for which the total number of swings is below a threshold.

By using these tools it is possible to focus on specific patterns.


I must admit I did not spend much time analyzing the result (I hope you would do it for me! :-)). Anyway some few things soon hit the eye:

  • It is not evident which states swing or do not swing but it is quite clear that they tend to swing all to the same direction. Every column in fact contains entries almost all of the same color.
  • Some years have had very large scale swings: 1912, 1916, 1932, 1952, 1963, etc.
  • Luisiana (LA) had an impressive number of consecutive swings between 1948-1980, changing from one party to another in every election.

I am pretty sure there are hundreds of interesting patterns to discover yet . I hope you would find some of them.

Potential Improvements

There are obviously a very large number of potential improvements that might be included in the visualization, it is by no means a finished product, rather a toy.
One interesting feature I have seen proposed that I did not include, is the ordering of the states (rows) to bring together the states that tends to behave similarly. In this way it would be possible to cluster them visually and gain some additional insights. So far, however, I didn’t have enough time to implement it.
Another filter could be added to isolate not only states with big sweeps but also years with big sweeps. Again, this is not yet implemented.


I really hope you would like to critique this visualization and suggest potential improvement. At the same time it would be nice to know if you have found some additional interesting patterns.
The additional data about presidents and winning party can be found here: presidents_mod.csv.