Working with Election Data

In my last post, I began to work with using Processing and more complex data sets.  After working out the bugs of working with two dimensional arrays, I wanted to tackle a more complex array than the highs and lows of a fourteen day forecast.

With an upcoming election in Canada, I wanted to find some data and work with that, as per Ben Fry’s approach I had outlined earlier. I thought that exploring the history of our elections and see what i could find from that.

The first step was to find some data. The first group of data I’d found was on Elections Canada; the historical data for past elections. It included the years, the population and voter turnout. After finding the data, it was necessary to parse and clean it. The original data was in an html table. I had to cut this data from the site and get it into a format that I could use in Processing. The data from Elections Canada also had data for referendums which i had to filter out.

While it had some interesting trends, there was more to the elections than the turnout. To augment this dataset, I cross-referenced it with historical election data from Wikipedia’s History of Canadian federal elections. The source for this data was the Parliament’s History of Federal Ridings website. I would have taken the data directly from there, but the interface for the website is poor and scraping the data would have been time consuming.

The data that I added to the Elections Canada data was the Prime Ministers elected, the number of seats the winning party secured and the total number of seats during that election.

Then began the phase of mining the data; looking for something interesting. The last three elections have yielded minority governments in Canada. Between this and talk of a coalition government, I felt it was worthwhile to look at the history of majority, minority and coalition governments in Canada.

I first loaded up the data and created a preliminary visualization. I wanted to map these three types of governments through time and see what happened:

The rectangles indicate majority governments, the ellipses are minority governments. Red indicates Liberals, blue is Conservatives or Progressive Conservatives. The Grey box is the only coalition government in Canada’s history. While this uses data to generate a visualization, the visualization is not compelling or even that communicative. It was time to refine. The height of the shapes indicates the number of years that government were in power.

Before I proceeded, I decided that this may be best suited as a static presentation so I began to plan how to visually represent this data on a piece of paper or in a static image. There wasn’t much to play with within the data, and the concepts were simple enough that the static approach would work. After some experimentation, I came to build this visualization:

 

I had decided to look at each election separately, but present them together. Each circle represents an election. The colour of the inner circle is the colour of the winning party (red for liberal, blue for conservative) and the size of that inner circle is the percentage of the total seats won. Circles outlined with the party colour indicates they won a majority. Finally, I added the name of the prime minister for that government as well as the year the election occurred.

data-driven

Permalink

Leave a Reply

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

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>