<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>OUseful.Info, the blog... &#187; Visualising MPs&#8217; Expenses Using Scatter Plots, Charts and Maps</title>
	<atom:link href="http://blog.ouseful.info/2009/04/02/visualising-mps-expenses-using-scatter-plots-charts-and-maps/feed/?withoutcomments=1" rel="self" type="application/rss+xml" />
	<link>http://blog.ouseful.info</link>
	<description>Trying to find useful things to do with emerging technologies in open education</description>
	<lastBuildDate>Mon, 20 May 2013 11:27:56 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='blog.ouseful.info' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>OUseful.Info, the blog... &#187; Visualising MPs&#8217; Expenses Using Scatter Plots, Charts and Maps</title>
		<link>http://blog.ouseful.info</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://blog.ouseful.info/osd.xml" title="OUseful.Info, the blog..." />
	<atom:link rel='hub' href='http://blog.ouseful.info/?pushpress=hub'/>
		<item>
		<title>Visualising MPs&#8217; Expenses Using Scatter Plots, Charts and Maps</title>
		<link>http://blog.ouseful.info/2009/04/02/visualising-mps-expenses-using-scatter-plots-charts-and-maps/</link>
		<comments>http://blog.ouseful.info/2009/04/02/visualising-mps-expenses-using-scatter-plots-charts-and-maps/#comments</comments>
		<pubDate>Thu, 02 Apr 2009 23:44:35 +0000</pubDate>
		<dc:creator>Tony Hirst</dc:creator>
				<category><![CDATA[Data]]></category>
		<category><![CDATA[Tinkering]]></category>
		<category><![CDATA[Visualisation]]></category>
		<category><![CDATA[datastore]]></category>
		<category><![CDATA[OpenPlatform]]></category>

		<guid isPermaLink="false">http://ouseful.wordpress.com/?p=1557</guid>
		<description><![CDATA[A couple of days ago, the Guardian&#8217;s @datastore announced that a spreadsheet of UK MPs&#8217; (Members of Parliament) expenses had been posted to the Guardian OpenPlatform datastore on Google Spreadsheets. Just because, I though it would be nice to visualise the spreadsheet using some Many Eyes Wikified charts, so I had a look at the [&#8230;]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.ouseful.info&#038;blog=325417&#038;post=1557&#038;subd=ouseful&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>A couple of days ago, the Guardian&#8217;s @datastore <a href="http://twitter.com/datastore/status/1427574732">announced</a> that a spreadsheet of UK MPs&#8217; (Members of Parliament) expenses had been posted to the Guardian OpenPlatform datastore on Google Spreadsheets.</p>
<p>Just because, I though it would be nice to visualise the spreadsheet using some Many Eyes Wikified charts, so I had a look at the data, and sighed a little: in many of the spreadsheet cells was a pound sign, and Many Eyes doesn&#8217;t like those &#8211; it just wants numbers&#8230; So I went in to Yahoo pipes to create a pipe to tidy up the CSV output of the spreadsheet so I could pipe it into Many Eyes Wikified&#8230; and drew a blank: I couldn&#8217;t get the pipe to work (no CSV &#8211; just HTML (it turns out I was using the wrong URL pattern from the spreadsheet  &#8211; doh!)). So I exported the CSV, reg-exped it in a text editor, adn uploaded it to create a new spreadsheet. (Which reminds me: note to self &#8211; create a tidy-upper pipe fed from the datastore and refactor the wikified data page to feed from the pipe&#8230;)</p>
<p>[Many Eyes Wikified is no longer available as a service - to replicate the following visulisations, you need to upload the data to Many Eyes (the none wikified version...). I <a href="https://docs.google.com/spreadsheet/ccc?key=0AmbQbL4Lrd61cDFySFVxZzRnNDIwVU1hTjFzUHZhUmc&amp;hl=en_GB#gid=0"><em>think</em> this is the spreadsheet</a> I was pulling in to the Wikified service...]</p>
<p><s>So anyway, here are some interactive ways of <a href="http://manyeyes.alphaworks.ibm.com/wikified/ousefulTestboard/MPsExpenses07_08Viz">visualising MPs&#8217; expenses data using Many Eyes wikified</a>&#8230;</p>
<p>Firstly, a <a href="http://manyeyes.alphaworks.ibm.com/wikified/ousefulTestboard/MPExpensesData2007_8:MPExpenses07_08VizBarChart">bar char</a> &#8211; select which expenses category you&#8217;d like to chart and then view the ranked distribution by sorting by values. If you mouse over any of the bars, you&#8217;ll see which MP made that claim:</p>
<p><a href="http://manyeyes.alphaworks.ibm.com/wikified/ousefulTestboard/MPExpensesData2007_8:MPExpenses07_08VizBarChart" title="Photo Sharing"><img src="http://farm4.static.flickr.com/3638/3407400337_9a852ac320.jpg" width="500" height="258"></a></p>
<p>Second up, a <a href="http://manyeyes.alphaworks.ibm.com/wikified/ousefulTestboard/MPExpensesData2007_8:MPExpenses07_08VizStackedChart">block histogram</a> view. This chart is good for looking at the natural distribution of different claim categories. The search box makes it easy to search for your MP by name:</p>
<p><a href="http://manyeyes.alphaworks.ibm.com/wikified/ousefulTestboard/MPExpensesData2007_8:MPExpenses07_08VizStackedChart" title="Photo Sharing"><img src="http://farm4.static.flickr.com/3366/3407406925_801e0320f7.jpg" width="500" height="277"></a></p>
<p>Again, mousing over any of the blocks identifies the name of the MP making that claim.</p>
<p>Thirdly, a <a href="http://manyeyes.alphaworks.ibm.com/wikified/ousefulTestboard/MPExpensesData2007_8:MPExpenses07_08VizStackedChart2">scatter plot</a>. This display lets you compare an MP&#8217;s claims across two categories, and potentially bring in a thrid category using the dot size:</p>
<p><a href="http://manyeyes.alphaworks.ibm.com/wikified/ousefulTestboard/MPExpensesData2007_8:MPExpenses07_08VizStackedChart2" title="Photo Sharing"><img src="http://farm4.static.flickr.com/3001/3408220946_f380cc6470.jpg" width="500" height="275"></a></p>
<p>As with the other visulisations, mouse over any point to see which MP it belongs to.</s></p>
<p>By the by, along the way I did a couple of other Yahoo pipes &#8211; one to extract <a href="http://pipes.yahoo.com/pipes/pipe.info?_id=UuvYtuMe3hGDsmRgPm7D0g">expenses by MP name</a>, (which simply pulls in CSV from the spreadsheet, then filters on an MP&#8217;s surname),  the other <a href="http://pipes.yahoo.com/pipes/pipe.info?_id=YvByweMe3hGA8BgNJ5REag">MPs&#8217; expenses by postcode</a>. The latter pipe actually embeds the foemer, and works by looking up the name of the MP by postcode, using the <a href="http://www.theyworkforyou.com/api/">TheyWorkForYou API</a>; this name is then passed in to an embedded &#8216;expenses by name&#8217; pipe.</p>
<p>Anyway, back to the viz biz: Charles Arthur generously picked up on my tweets announcing the visualisations with a blog post on the Guardian data blog (<a href="http://www.guardian.co.uk/news/datablog/2009/apr/01/mps-expenses-houseofcommons">Visualising MP expenses</a>) in a post that included the tease:</p>
<blockquote><p>But what we need now is a dataset which shows constituency distances<br />
from Westminster, so that we can compare that against travel. And perhaps someone else can work out the travelling MPs&#8217; carbon footprints based on whether they went by air or rail or car</p></blockquote>
<p>No fair&#8230; Okay &#8211; so where to get the location data for each MP. Well, the TheyWorkForYou API came to my rescue again. One call (to <em>getConstituencies</em>) pulled out details of each constituency, which included the lat/long geo-coordinated of the &#8216;centre&#8217; of each constituency (along with the co-ordinates of the bounding box round each constituency&#8230; maybe I&#8217;ll use those another time ;-) A second call (to <em>getMPs</em>) pulled out all the MPs, and their constituencies. Loading both sets of data into different sheets on Dabble DB, meant I could then link them together by constituency name (for more on linking data in Dabble DB, see <a href="http://ouseful.wordpress.com/2009/02/16/mashcombining-data-from-three-separate-sources-using-dabble-db/">Mash/Combining Data from Three Separate Sources Using Dabble DB</a> and <a href="http://ouseful.wordpress.com/2009/02/17/using-dabble-db-in-an-online-mashup-context/">Using Dabble DB in an Online Mashup Context</a>).</p>
<p>Adding the MP data into Dabble DB after a further bit of cleaning &#8211; removing things like Mr, Miss, and Sir from the firstnames etc &#8211; and linking by MP name meant that I could now generate a single data view that exposed MPs by name, constituency, and expense claims, along with the geolocation of the midpoint of their constituency.</p>
<p>After grabbing the CSV feed out of this Dabble DB view into a pipe, and tidying up the data a little once again (eg removing commas in the formatted numbers), it was an easy matter to pull the JSON output from the pipe into a map, and plot different coloured markers depending what &#8216;band&#8217; the MPs&#8217; total expenses fell into. Here&#8217;s a snapshot of that <a href="http://ouseful.wordpress.com/2009/02/17/using-dabble-db-in-an-online-mashup-context/">first map</a>:</p>
<p><a href="http://ouseful.open.ac.uk/maps/mpTravelExpensesMap.html" title="Photo Sharing"><img src="http://farm4.static.flickr.com/3412/3408259832_8ff3838fac.jpg" width="406" height="500"></a></p>
<p>All well and good &#8211; what&#8217;s nice about this view is that it&#8217;s quite easy to see which MPs appear to be claiming disproportionately more than other MPs with constituencies in a similar area. (There may be good reason for this, like, err&#8230; whatever. This tool is just a <em>starting point</em> for sensemaking round the data, right?!;-). If you click on one of the markers you can pop up a little info window, too (rather sparse in this first demo):</p>
<p><a href="http://ouseful.open.ac.uk/maps/mpTravelExpensesMap.html" title="Photo Sharing"><img src="http://farm4.static.flickr.com/3630/3407453599_47ece4ba3d.jpg" width="445" height="476"></a></p>
<p>In that first map, the only expenses data I was exposing, and mapping, was the total travel expenses claimed. So over a coffee this afternoon, I created a richer view, and tweaked the map code to let me inspect a couple of other data sets. You can find the map here: <a href="http://ouseful.open.ac.uk/maps/mpTravelExpensesMapG.html">MPs&#8217; travel expenses map</a>.</p>
<p>So for example, we can look at mileage claims:</p>
<p><a href="http://ouseful.open.ac.uk/maps/mpTravelExpensesMapG.html" title="Photo Sharing"><img src="http://farm4.static.flickr.com/3393/3407463935_841932d91e.jpg" width="400" height="500"></a></p>
<p>Or the total expenses claimed for living away from the primary home:</p>
<p><a href="http://ouseful.open.ac.uk/maps/mpTravelExpensesMapG.html" title="Photo Sharing"><img src="http://farm4.static.flickr.com/3555/3407466217_5c85cfb583.jpg" width="412" height="500"></a></p>
<p>One thing these quick to put together maps show is how powerful map based displays can be used to get a feel for local differences where there is a difference. (There may well be a good reason for this, of course; including errors in the data set being used&#8230;)</p>
<p>It&#8217;s also interesting to use the map based displays in conjunction with other chart based visualisations, such as the <a href="http://manyeyes.alphaworks.ibm.com/wikified/ousefulTestboard/MPsExpenses07_08Viz">MPs&#8217; expenses visualisations on Many Eyes Wikified</a>, to explore the data in a far more natural way than trying to make sense of a <a href="http://spreadsheets.google.com/ccc?key=phNtm3LmDZEObQ2itmSqHIA">spreadsheet containing the MPs&#8217; expenses data</a>.</p>
<p>Enjoy :-)</p>
<p>PS the code is all as is; if it&#8217;s broken and the visualisations are consequently wrong/misleading, then I apologise in advance&#8230; ;-)</p>
<p>PPS See also: <a href="http://ouseful.wordpress.com/2009/03/20/my-guardian-openplatform-apindata-hacks-roundup/">My Guardian OpenPlatform API’n&#8217;Data Hacks’n&#8217;Mashups Roundup</a>, which describes 6 different recipes for playing with Guardian openplatform resources. And if you&#8217;re into F1, see <a href="http://ouseful.wordpress.com/2009/03/29/visualising-lap-time-data-australian-grand-prix-2009/">Visualising Lap Time Data &#8211; Australian Grand Prix, 2009 </a>! ;-)</p>
<p>PPPS see also <a href="http://ouseful.wordpress.com/2009/05/03/mps-expenses-by-constituency-sort-of/">MPs&#8217; Expenses by Constituency, Sort Of&#8230;</a>, where I plot a couple of really colourful proportional symbol maps based on total travel expenses&#8230;</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ouseful.wordpress.com/1557/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ouseful.wordpress.com/1557/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.ouseful.info&#038;blog=325417&#038;post=1557&#038;subd=ouseful&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.ouseful.info/2009/04/02/visualising-mps-expenses-using-scatter-plots-charts-and-maps/feed/</wfw:commentRss>
		<slash:comments>30</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/abbd9f90565ce9ae4d065d93a81d8c03?s=96&#38;d=http%3A%2F%2F1.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96" medium="image">
			<media:title type="html">Tony Hirst</media:title>
		</media:content>

		<media:content url="http://farm4.static.flickr.com/3638/3407400337_9a852ac320.jpg" medium="image" />

		<media:content url="http://farm4.static.flickr.com/3366/3407406925_801e0320f7.jpg" medium="image" />

		<media:content url="http://farm4.static.flickr.com/3001/3408220946_f380cc6470.jpg" medium="image" />

		<media:content url="http://farm4.static.flickr.com/3412/3408259832_8ff3838fac.jpg" medium="image" />

		<media:content url="http://farm4.static.flickr.com/3630/3407453599_47ece4ba3d.jpg" medium="image" />

		<media:content url="http://farm4.static.flickr.com/3393/3407463935_841932d91e.jpg" medium="image" />

		<media:content url="http://farm4.static.flickr.com/3555/3407466217_5c85cfb583.jpg" medium="image" />
	</item>
	</channel>
</rss>
