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.

3 thoughts on “Swing States Visualization

  1. Robert Kosara

    Very nice! Though while I agree that only showing changes helps reduce clutter, I also find it a bit hard to read the visualization. It would be nice to be able to switch between all the years and just the changes. I also wonder if showing both the “from” and the “two” color would make it easier to see swings.
    I also think that you swapped the From and To fields: when I select Republican to Democrat, I see lots of red, but I should be seeing blue instead.
    The filtering by swings is a cool idea, but perhaps you could grey out the entire row, not just the short bars; that would make it easier to see which ones have been deselected. The big sweep years would be neat, but those are quite visible from the visualization.

  2. Registered User

    Hi Robert,
    Thanks a lot for you comments, they are always appreciated! I agree with you remarks and I’ll try to implement some modifications as soon as I can.

  3. sqiar

    SQIAR (http://www.sqiar.com/solutions/technology/tableau) is a leading global consultancy which provides innovative business intelligence services to small and medium size (SMEs) businesses. Our agile approach provides organizations with breakthrough insights and powerful data visualizations to rapidly analyse multiple aspects of their business in perspectives that matter most.


Leave a Reply

Your email address will not be published. Required fields are marked *