Post-election mapping
This continues on from the previous post, trying to make some sense of the voting in my electorate of Wills and the neighbouring electorate of Cooper. Both these electorates (or more formally "Divisions"), as I mentioned in the previous post, are very similar in their geography, demography, and history.
Last post I simply showed a map of voting booths, using a circle roughly proportional to the size of the ratio of votes between the two major candidates. This used a local system called Two Candidate Preferred, which indicates the results after all preferences have been distributed. Australian lower house elections use a preferential system formally called instant run-off voting, in which each voter numbers all candidates in order of preference. The candidates with lowest counts are successively removed from the counting; their ballots being passed on to other candidates using the highest available preference on a ballot. This continues until only two candidates remain; the one with the largest number of votes is the winner.
Although the full count can take some weeks - this must include all the pre-poll votes, postal votes, and absentee votes - an indicative TCP is usually available on the evening of an election. There are sometimes a handful of electorates for which an outcome may not be known for some time, especially if the count is very close. In this most recent election, the division of Macnamara took a long time to be counted: it was a three way contest between Liberal, Labor, and the Greens, with very similar first preference counts for all three parties. It was thus a count which relied very heavily on preferences.
For this post I was interested in overlaying the electorate with a Voronoi diagram based on the booths. This is a subdivision of the electorate into regions around each booth; each such region consists of the points in the plane which are close to that particular booth than any other. If we make the simplifying (and not unreasonable) assumption that everybody votes in the booth closest to where they live, we can thus subdivide the electorate into Greens/ Labor regions.
The idea is to colour each region by its TCP: a booth that favours labour will have its corresponding region red, and a booth that favours the Greens will have its corresponding region green.
To obtain the Voronoi diagram we make use of the Python library geovoronoi which returns regions as shapefiles. These can then be easily converted to Json files for including on a folium map.
Here are the results, first for Wills:
and for Cooper:
Naturally these maps cannot tell us everything, and their limitations must be noted: there is no attempt to provide shades of colour for the size of the ratio. That is, a booth with a Labor to Greens voting ratio of 3.5 gets the same shade of red as a booth with a ratio of 1.01. However, the popups show the ratio at each booth.
The numbers of votes cast at the booths are not equal. For instance, if you go to the AEC page for Wills and check out the TCP numbers by polling place, numbers of votes cast range from 71 at Strathmore North to 2739 at Brunswick North, to even larger numbers at the pre-poll voting centres, Northcote and Pascoe Vale, with 5210 and 15141 total votes cast respectively. A better map may make adjustments both for the value of the ratio, and the total number of votes cast.