Data Visualisation – Global Gender Balance
// February 18th, 2010 // Creative
I’ve spent a few hours playing with Tableau Public, a free version of the rather expensive Tableau data visualisation app, and it’s pretty good. After a random discussion of how Estonia has, according to the Economist world stats book, 84 guys to every 100 girls, I prepared this map in a couple of hours as an exercise in understanding how Tableau works:
The map shows the male:female ratio of every country as coloured crosses, from red (more women) to blue (more men); the size of the cross is proportional to the country’s population.
Tableau Public is a cut-down version of commercial software, with no ability to save files locally. In theory you can publish your diagrams to the web on their site, but that feature was a bit broken when I tried it.
This means that you have to retrieve your diagrams using screenshots, and I have no idea what the legal implications of doing that are if you intend to use them for anything but personal interest and satisfaction! It does constrain the quality a little, too.
Being lazy, I didn’t want to type in all of the raw data from the Economist book, so I pulled it from Wikipedia: population data came from here and sex ratio from here. Copying the tables directly into Excel brought a load of unwanted links and images, so I copied into Notepad++ – where it appears as tab separated values – and reloaded as a TSV file via disk.
The country names had a few extra spaces and other characters in them – I pulled these out with the
LEN etc functions.
Tableau theoretically understands full country names, but I had mixed success getting this to work, so I imported a lookup table of two letter ISO 3166-2 codes, which are also supported and are unambiguous.
I then used
VLOOKUP to pull together all this information into a single Excel sheet (remember to turn range lookup – the fourth, optional argument – off); as the data came from diffferent sources, there was a little messing round standardising country names. The finished spreadsheet is here if you want to play with it.
Visualizing in Tableau
It really helps to look at this tutorial video before starting anything – Tableau starts with quite a blank slate!
Open up the XLS in Tableau, and it’ll make a first stab at identifying what is what from the Excel column formats. You’ll see the fields seperated into text and numeric lists down the left hand side.
If you don’t see a globe next to the Country Code field, right click, go to the Geographic Role submenu, and select Country (ISO 3166-2). Tableau can now map this to a geographical location automatically. Also ensure all numeric columns are recognised as numeric with the Change Data Type submenu.
To recreate the map visualisation, follow these (approximate!) steps:
- Select the Country Code and Total fields, and click on the Show Me! button.
- Select the map diagram type (near the bottopm of the list). You should see some dots across a map.
- Drag the Population column over to the Size box, right click and select Dimension to scale the dots by population.
- Drag the Total column to the Colour box and they should become shades of green; further down is a green graduation which you can click on to change, and adjust to a red-blue graduation. Click on Advanced and set the midpoint to 1.0, to make the middle grey represent a 1:1 ratio.
Your left hand panels should look a little like this now:
This is really just a very high speed starter and I’ve barely dipped below the surface – I’ve got some quite complex business plan data that I’ll be dropping in later to experiment further.