The elec­tion may be done and dus­ted, and a new Par­lia­ment sworn in, but the post mortems will con­tin­ue in many polit­ic­al circles. We now have detailed vot­ing records from every booth in the coun­try, and while some aspects of booth data are prob­lem­at­ic (see the tech­nic­al notes below for some pro­vis­os), it’s the finest level of elect­or­al data we have, and look­ing at how each booth voted might reveal some inter­est­ing rela­tion­ships. Can it also help us answer some of those burn­ing ques­tions, such as: did some parties “steal” votes from oth­ers? Is the Green Party just for urb­an lib­er­als? Is Wel­ling­ton in a bubble of its own?

There’s a huge amount of data, and one of the first tools a data visu­al­iser often employs to explore a big data­set is a scat­ter­plot mat­rix. This plots every vari­able against every oth­er one, and where there’s a strong rela­tion­ship this stands out as a dis­tinct line or cluster rather than an amorph­ous blob. The mat­rix below shows a scat­ter plot for each pair of parties, chart­ing the pro­por­tion of the vote that they each received, with a tiny dot for each one of over 5000 booths. I’ve also col­oured the booths accord­ing to some broad elect­or­ate cat­egor­ies (Wel­ling­ton, oth­er urb­an, rur­al, and Māori), and the diag­on­al shows his­to­grams of each party’s vote by booth, broken down by these cat­egor­ies. What does the data show us?

2014 Election Scatterplot Matrix

You can click on the chart for a lar­ger ver­sion, but even at this scale cer­tain things stand out. There’s not a lot of pos­it­ive cor­rel­a­tion between pairs of parties, except some weak ones such as between Nation­al and the Con­ser­vat­ives and Labour and Inter­net Mana. There’s a neg­at­ive cor­rel­a­tion between Nation­al and Labour, as one might expect. The Māori elect­or­ates often stand out, partly because there are a lot of applic­able booths, but also because of some strong clus­ter­ing. Some of the smal­ler parties, such as ACT, Māori, Inter­net Mana and Con­ser­vat­ive, show intense polar­ising effects: booths cluster along the axes in an L shape, show­ing that a lot of booths had little or no votes for one of those but rel­at­ively high votes for the oth­er. It might be just my choice of col­ours, but Wel­ling­ton does­n’t stand out as much as I had been led to expect.

After the break, let’s zoom in to some of the more sig­ni­fic­ant com­par­is­ons.

Here’s Labour vs Nation­al. The Māori elect­or­ates are almost entirely sep­ar­ate, with very few booths vot­ing strongly Nation­al, even where Labour sup­port is weak, and many booths show­ing no Nation­al votes at all in Māori elect­or­ates. For the gen­er­al elect­or­ates, not only is there a very marked neg­at­ive cor­rel­a­tion, but there’s a clear gradi­ent between Nation­al-dom­in­ated rur­al elect­or­ates and urb­an Labour strong­holds.

Scatter plot: National vs Labour

Wel­ling­ton does­n’t show much clus­ter­ing on the scat­ter­plot, and on the his­to­grams it looks to be only slightly more Labour-lean­ing than oth­er urb­an places. The his­to­gram axes can be a bit con­fus­ing at first: they show the degree of a party’s sup­port along the x axis, with the y axis show­ing the pro­por­tion of booths that voted that strongly for that party. Labour’s party his­to­gram is at top left, show­ing rur­al elect­or­ates skew towards low Labour votes, fol­lowed by urb­an, Wel­ling­ton and Māori elect­or­ates. Nation­al sup­port (bot­tom right) is the oppos­ite, as one would expect, but with an even more dis­tinct dif­fer­ence in Māori vote.

A subtle point is that while Wel­ling­ton’s Labour peak is slightly high­er, there are few­er booths lean­ing strongly Labour than in oth­er cit­ies, and there are also few­er strong Nation­al booths in the Wel­ling­ton region. I sus­pect a lot of the sup­posed dis­tinct­ive­ness of the “belt­way” only applies to a small part of great­er Wel­ling­ton, but that will have to wait for anoth­er visu­al­isa­tion. In the mean­time, let’s look at Labour com­pared to the Green and Māori parties.

Scatter plots: Labour, Maori Party, Green

Now Wel­ling­ton stands out! While most great­er Wel­ling­ton booths still have a low Green vote, their sup­port very dis­tinctly bulges out in Wel­ling­ton. You can just make out a golden cluster of Wel­ling­ton booths on the Green vs Labour chart, and it’s centred close to where the Labour vote peaks. There’s an appar­ent clus­ter­ing of strongly Labour urb­an places that get little sup­port for the Māori and Green parties, but there are little yel­low Wel­ling­ton dots spread through­out, from high Green/low Labour (what’s the bet that’s the Aro Val­ley?) to low Green/high Labour. Maybe the lat­ter are those myth­ic­al “tra­di­tion­al work­ing class sub­urbs”, but then again some of the highest Green votes came from the Māori elect­or­ates.

This scat­ter­plot mat­rix has done what I hoped it would: answer a few ques­tions, but raise even more. I’ll try some geo­graph­ic­al ana­lys­is soon, once I’ve got lat­it­ude and lon­git­ude data for the booths.

Technical notes

The booth data comes from the Elect­or­al Com­mis­sion’s final “party votes recor­ded at each vot­ing place” page. I use the term “booth” rather than the offi­cial “vot­ing place”, since each vot­ing place (church, com­munity hall etc) has bal­lot boxes for sev­er­al elect­or­ates. Each of these is recor­ded sep­ar­ately in the data, so that those who vote at Aro Val­ley Com­munity Centre and are registered in the Wel­ling­ton Cent­ral elect­or­ate are coun­ted sep­ar­ately from those who vote there but are registered in Ron­go­tai, for example.

Using booth loc­a­tions as a proxy for a finer geo­graph­ic grain of com­munity than elect­or­ates is prob­lem­at­ic, largely for the above reas­on. People don’t always vote at the nearest polling place to their home: they could vote while out shop­ping, on their way to work, or while tak­ing their kids to Sat­urday sports. This spread could be even more pro­nounced with early vot­ing. Nev­er­the­less, many booths have shown con­sist­ent pat­terns over time, and they seem to cor­rel­ate with demo­graph­ic pat­terns with­in diverse elect­or­ates. For the pur­poses of this ana­lys­is, each vot­ing place/electorate com­bin­a­tion rep­res­ents a group of voters with cer­tain geo­graph­ic sim­il­ar­it­ies of home and habit, so I thought that I’d keep these as sep­ar­ate data points.

Some booths have very few voters, and you can see strong diag­on­al lines in some of the scat­ter plots where there’s a simple integer ratio between votes for one party and anoth­er (e.g. 1 Green vote and 2 Labour votes, or 2 Green votes and 4 Labour votes). Where these lines are very vis­ible, this would sug­gest very low voter num­bers (either a booth serving a small pop­u­la­tion, or a party with little sup­port), and some cau­tion would be wise.

Elect­or­ates that cov­er a wide geo­graph­ic­al area, such as rur­al and Māori elect­or­ates, tend to have a lot of booths, so they show up strongly on the plots. Many of these would rep­res­ent very few votes, so they can give a skewed per­cep­tion of over­all voter num­bers. I might vary the size or opa­city of the dots accord­ing to total votes in future ver­sions, but for now don’t let the num­ber of dots sway you too much: it’s more about dis­tri­bu­tion.

I col­oured the booths based upon the elect­or­ate, rather than the phys­ic­al loc­a­tion of the vot­ing place. I coun­ted Wel­ling­ton Cent­ral, Ron­go­tai, Ōhāriu, Hutt South, Rimu­taka and Mana as “Wel­ling­ton” elect­or­ates, but the urban/rural dis­tinc­tion was fairly arbit­rary, based upon pop­u­la­tion dens­ity.

I acquired and pro­cessed this data with mostly open source tools. Python down­loaded and parsed the CSV files, which then loaded them into Post­gr­eSQL for stor­age and pro­cessing. I used R/RStudio to carry out stat­ist­ic­al pro­cessing and cre­ate the charts, using the ggplot2 and GGAlly pack­ages, then expor­ted them as SVG. The SVG was mas­saged with Ink­s­cape and Python, and finally tidied up with a bit of Pho­toshop.