The Shape of our Democracy

Firstly a note about browsers, the diagrams below work great in Firefox on Ubuntu, with little popup tooltips when you hover over the dots. Google Chrome does not seem to display the tooltips which is a bit of a shame. Internet Explorer probably doesn’t display the diagrams at all, upgrade to Firefox. If you are reading this on a planet, click through to the blog to find the diagrams.
There has been much talk of a possible hung parliament in the forthcoming UK General Election, this is what happens when one party does not get enough seats in the House of Commons to survive a vote of no confidence in the government. So the other parties, if they felt like it, could bring down the government at any time. It isn’t ideal, and coalition governments formed by parties doing deals to gang up on the remaining parties tend not to last that long. There are worse things than a hung parliament that can happen with our first past the post voting system, a party could win the most votes nationally, but actually a different party could get more seats, perhaps even enough to win outright without a hung parliament. That is a very very bad situation. Luckily we have a very stable country and the chances of a civil war starting are low, here the leaders are more likely to step outside and settle the matter like men, with a game of rock-paper-scissors. Joking aside, this is a scenario where having a constitutional monarchy with the Queen as commander in chief of the armed forces seems like a rather good idea.
So what does happen in the different possible scenarios? A regular swingometer won’t tell you the full picture so we have put together something rather different. The triangle below plots the outcomes of different predicted results based on different national percentages of the vote. It is based on data from the UK Polling Report swing calculator assuming 10% of the vote is “other” and sharing out the remaining 90% in every possible combination between the three main parties (it actually goes from 1% to 88% for each party because the calculator doesn’t like zero values) so at each corner of the triangle is the maximum landslide for one of the parties. The area in the middle with the darker dots is the hung parliament zone, the dots are coloured according to which is the biggest party, which would be the one trying to form a minority government. At the centre is a white dot marking the 30:30:30 share of the vote point. If this happens the seat distribution is about Labour:300, Conservative:200, Liberal Democrat:100 which shows some of the surprising results that can happen. The green lines divide up the regions according to the party that won the national vote, you can clearly see that the divisions based on seats are not aligned with the national vote lines, it also becomes pretty clear why the Liberal Democrats are not fans of the current voting system.

The extremes of the above triangle are really never going to happen. Lets have a look at the same thing again, but focussing just on the area of plausibility where no party collapses to less than 10% and no party has a landslide greater than 50% of the national vote. Here you can see that the hung parliament zone seems a bigger target to hit, also the uphill struggle for the poor old Lib Dems is even clearer. We also plotted in green the approximate positions of the previous election results back to 1997, hover over them to see which is which.
The bit that is the area of political crisis is the bright red bit at the top to the left of the green line, plus the small and rather unlikely bright red bit on the right below the Labour/Conservative green line.

The Geek Vote can swing this election, but an outright win isn’t the only prize at stake. Smaller parties are trying to win their deposit back and get enough votes that they are motivated to come back next time. If one of the main parties wins outright then size of their majority affects whether they can force through controversial legislation or not. If a hung parliament is the outcome the the relative sizes of all the parties affects the possible negotiated coalitions that are possible. Small swings in the vote can have a very big consequence in the volatile area in the centre of the triangle, the Geek Vote counts, don’t forget to use it.

Methodology and Caveats

  • The data assumes “Other” (Independents and small parties such as the Greens and the Pirate Party) win 10% of the national vote, which is a bit high.
  • Boundary changes and other issues could well mean we plotted the results of past elections in the wrong place, the seat numbers for the past election are the predicted seat results for this election, not the actuals from the past one.
  • Uniform National Swing isn’t the only means of guessing seat results from changes in votes, local issues can change the results in unexpected ways, it is just an approximation
  • The data was generated from a series of Python scripts running on Ubuntu Linux, firstly using twill to fill out the form, then beautifulsoup to read the results, finally the output was processed by a script to directly write the SVG files.
  • It would be great to see some kind of animated wandering dot that moves about the chart over time with opinion poll results.


This is the initial script that feeds in the values and scrapes the results. It’s output is a kind of messy .csv format which I piped through grep to get rid of lines that were not csv.

from twill.commands import *
from twill import get_browser
from BeautifulSoup import BeautifulSoup
for ld in range (91):
for con in range (91-ld):
#print ld,con,lab
formvalue("1", "con", con.__str__())
formvalue("1", "lab", lab.__str__())
formvalue("1", "ld", ld.__str__())
results=b.get_html().replace("","")#hack to get round weak parser in python 3
print '"'+con.__str__()+'","'+lab.__str__()+'","'+ld.__str__()+'","'+conres+'","'+labres+'","'+ldres+'","'+ores+'","'+outcome+'"'

The output of that is here. This was then read back in by the following script, which prints out an SVG file as output. I tweaked it a few times to do the different outputs.

import csv
print """

Sultans of Swing """

r=csv.reader(open('uns.csv')) for row in r: con=float(row[0]) lab=float(row[1])

ld=float(row[2]) outcome=row[7] cx=0.8+(lab/5.0)+con*0.1 cy=0.4+con*.1732 #cx=0.5+(lab/5.0)#experimental right angle triangle layout - didn't like it, distorts the shape. #cy=0.5+(con/5.0) tip='Con:'+str(int(con))+' Lab:'+str(int(lab))+' LD:'+str(int(ld))+' - '+outcome if (con==30 and lab==30): print '' elif (con==43 and lab==36): print '' elif (con==42 and lab==27): print '' elif (con==42 and lab==31): print '' elif (con==42 and lab==34): print '' elif (con==30 and lab==43): print '' elif (con==32 and lab==40): print '' elif (con==32 and lab==35): print ''

elif (con<10 or lab<10 or ld<10 or con>50 or lab>50 or ld>50): # print '' False elif (con==0 or lab==0 or ld==0): #print '' False elif outcome.find('Conservative Majority')==0: print '' elif outcome.find('Labour Majority')==0: print '' elif outcome.find('Lib Dem Majority')==0: print '' elif outcome.find('Lib Dems')>0: print '' elif outcome.find('Labour')>0: print '' elif outcome.find('Conservatives')>0: print ''

else: print '' print """""" print """""" print """""" print""


  • ethana2 says:

    Is the Chrome problem the fault of the code, webkit, or Chrome proper? Anybody using Safari 4 care to tell us how it behaves for you?

  • Janne says:

    For what it’s worth, it seems to me Brits are a bit too worried about minority governments. Sweden has a fairly strict proportionality system (you get 35% of the vote, you get 35% of the seats), and haven’t had a majority government since 1968. Governing turns out to work pretty well anyway.

  • Alan Bell says:

    Yes, I would agree we may be overly fearful of hung parliaments, but at least with PR when the result is close it is still clear who came first.
    As for chrome, no idea, I will test on safari later. It also kind of works on the Opera Mini browser on the Blackberry amazingly enough.

Leave a Reply

XHTML: You can use these tags:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>