Tuesday, October 20, 2015

Hexmaps of the 2015 Canadian federal election

My apologies, these maps don't display well on mobile devices; I tried to fix it, but then they didn't display well on wide desktop screens. I need JavaScript lessons.

Riding-by-riding hexmap

Last night as of this writing, October 19, 2015, Canadians once again proved how difficult polling is in this country, and tossed the ruling Stephen Harper Conservative government out, to be replaced by the Liberals, led by Justin Trudeau, son of former PM Pierre-Eliot Trudeau. The left-learning New Democratic Party (NDP), elected in 2011 to be official opposition for the first time in what was called the 'Orange Wave', suffered an 'Orange Crush'.

It's hard to make maps of Canadian elections, because each riding has approximately the same number of electors, yet are of vastly different sizes due to particular geography of Canada. The smallest riding, at 6 square kilometers, is Toronto Centre; the largest, over 300,000 TIMES LARGER, is Nunavut (1.8 million sq. km.).

Therefore I made a hex grid of Canadian ridings (since the ridings are of equal population, it's technically a cartogram), which was a challenge. I used Spatialite to calculate shared borders and distances between riding centers, and Gephi to create network graphs. I tried to preserve, as much as possible, the local features (so that ridings which have neighboring borders and/or are close together will be in nearby hexes) and global features (the overall shape of Canada). It was hard, and I had to make lots of judgment calls; I leave it to others to judge the results.

The most striking part of this election as a spectator was on the right; the Liberals won every single one of the 33 seats in the Atlantic and Newfoundland time zones. These results were being released while the polls were still open in the West, an odd feature of Canadian politics. I can't help but think that has some effect.

Overall election results

I know, they're pie charts, which professionals hate, but they have two overwhelming virtues: everyone knows what they are when they look at them, and they (mostly) unambiguously show parts of a whole. The liberals outperformed the Conservatives by a factor of 1.24 in terms of votes, but 1.86 in terms of seats, and with a majority government end up with 100% of the power, which is why there are those who call for an end to first-part-the-post elections and the institution for some sort of more proportional representation scheme.

Traditional election map, for comparison

Here's a traditional map that preserves riding sizes. The smaller ridings are, of course, invisible, so it's hard to get an accurate picture. This is a screenshot from one of Canada's national newspapers, The Globe and Mail, and of course it's zoomable on their website; plus, I suppose I shouldn't criticize them too much since theirs was the only site nice enough to present election data in a form that I could scrape it at 4:00 a.m. the next day.

Hexmap of 2011 election (redistributed to 2015 ridings)

Canada was redistricted to have 338 ridings two years ago instead of the previous 308 (to the consternation of Canadian political statistics website www.threehundredeight.com, I'm sure), and the official government body Elections Canada was nice enough to show what the results of that election would have been with polling stations redistributed to the ridings they fall in now. You can see the Orange Wave in Quebec, and the Conservative majority government led by Ontario and the West, and the non-unanimously red East.

Second-place finishes

You can see most of the two-way battles were between Liberal and Conservative in Ontario and Alberta, NDP and Conservative in the rest of the prairies, Liberal-NDP or Bloc-NDP in most of Quebec, and Con-NDP or Con-Lib in the Atlantic. BC, as usual, has a bit of everything. The lone 'Other' second-place finish in Newfoundland is a former Liberal MP who was kicked out of the caucus amid sexual harrassment allegations and ran as an independent.

Margin of victory

Most of the landslides were in the Atlantic and Prairies, and most of the close finishes were in Ontario and Quebec.

Winners shaded by margin of victory

This allows us to see that the most of the landslides were Conservative in the Prairies, and Liberal elsewhere.

Voter turnout

Turnout was 68-69% (depending on whose numbers you use), far higher than the 61% in the 2011 election. The clusters of high turnout are in Ottawa (a political town), Vancouver Island (lots of old folks who like to vote), the Prairies (lots of dedicated Conservative voters) and the Atlantic provinces (who, it appears, were pissed off enough at the Conservatives to turn out in drovers). The lower vote turnouts seem to happen most often in rural ridings, where it's a longer driver to the polling stations.

Sources: Elections Canada (riding geography and statistics), The Globe and Mail (elections results)
Tools: Python, Chorogrid, JavaScript, Raphael.js, Gephi, Spatialite, Excel


  1. You should add the Abstentionist Party on your second pie chart. Just as in 2011, more eligible voters did not vote than voted for the majority party.

  2. the largest, over 640,000 TIMES LARGER, is Onatrio's Barrie-Inniskill (3.86 million sq. km.).

    I think the largest (territories excluded) is Abitibi—Baie-James—Nunavik—Eeyou in Quebec (https://en.wikipedia.org/wiki/Abitibi%E2%80%94Baie-James%E2%80%94Nunavik%E2%80%94Eeyou). Barrie-Innisfil is 386 square km, 10000 less than what you wrote :) (https://en.wikipedia.org/wiki/Barrie%E2%80%94Innisfil)

    1. Thanks for that, something weird happened in my Spatialite output. I've changed it.

  3. Great! Small correction, the Conservatives won a majority in 2011.

  4. This is a very beautiful and well thought out visualization. Thank you for doing it.

  5. I like your version of the 2015 Canadian Election results.
    Here's my cartogram of the post election landscape: www.politiquery.com
    Visually intuitive and simple to load. Cheers!

    1. Thanks for sharing that, I agree, your layout is very visually intuitive. Well done.

  6. Hi - is there a way you could share the underlying hex row/col values for each of the ridings? I know it was a lot of work, but a lot of others could benefit from it. It would be a great help to me and my visualization needs.

    Thanks in advance!

    1. Sure, they're here in my Github repo: https://github.com/Prooffreader/chorogrid/blob/master/chorogrid/databases/canada_federal_ridings.csv


Please leave comments & corrections here. Courtesy is appreciated.

Popular Posts

Scroll To Top