Category Archives: Tableau

Mapping Country Links in Tableau

Map I wanted!  

I’ve been looking to do this sort of visualisation with map data for a while; to show links between countries and to have the chunkiness of the lines correspond to particular amounts. I am still very, very new to Tableau but thought their tutorials may be a great place to start. The Advanced Mapping Techniques tutorial had exactly what I wanted, though bizarrely their training workbooks below the video don’t contain that specific example. However, by scrolling through the video and working it out myself – thank GOODNESS there was a shot of the data behind the scenes around the 1 minute mark – I managed to put together my own version, and it works! Woo hoo!

So, how did I get there? Here’s how to do it step-by-step:

1. Create a spreadsheet with the following data (you can copy & paste mine from below).

IMPORTANT – each line is a one-way path but in order for it work, there must also be a return path. For example, the data in the first row goes from the UK to US, but there also needs to be a return line back from the US to the UK (row 4). If you don’t do this, all the points in the first three rows will show in the UK unless they have return points – which is a bit pointless (fnarr!)

Country Path Total
UK UK-US 200
UK UK-Brazil 450
UK UK-China 700
US UK-US 200
Brazil UK-Brazil 450
China UK-China 700

2. Create your workbook in Tableau and import your data (I connect live so I can tweak my data behind the scenes).

3. Tableau will automatically generate the Longitude and Latitude for you, but make sure you spell the country names correctly! Then set-up the following dimensions:

Columns: Longitude
Rows: Latitude
Color: Path
Size: SUM(Total)

Here’s a screenshot to help! Oh and make sure it’s set to a “Line” graph.

Tableau setup

Hooray you now have your map set-up!

You can now do funky things like creating (sort of) arrows instead of fat lines by altering the data like this…

Country Path Total
UK UK-US 200
UK UK-Brazil 450
UK UK-China 700
Brazil UK-Brazil
China UK-China

This means the line width starts from nothing at the point of origin and grows as it reaches its destination. Your map should now look like this:

Map pointy lines

See, that was fairly painless, though I still want to continue having a play around with it, I’m sure there is a lot more you can do. I’d like to find a definitive list of country names that can be used in Tableau, can initials work too I wonder? Who knows, that’s for another time…

GCSE Results

There has been much chatter this week about GCSE results, which not only serves as a means by which to make me feel old (16 years ago people, 16 YEARS!) but it has also been a fabulous opportunity to dive in to the data. News outlets predictably report on the performance gap between girls & boys and the increase/decrease in the uptake of particular subjects…some things never change! I personally wanted to get my hands on the data so that I could whack it in to Tableau and play with it myself (thus also learning how to use Tableau too – double bonus!)

I obtained all of my data from a comprehensive Guardian article and wrangled it a bit get it in to the format that I needed (BIG shout out for the fabulous Tableau add-on for reshaping data in Excel!)

NOTE: As this blog is hosted by WordPress, I can’t embed the graphics due to Javascript restrictions. So if you want to see the graphics in all of their beauty and filter by different criteria, please click the link below each graphic).

GCSE Subject Breakdown

Subjects taken by all candidates in 2013 – interactive graphic allows you to filter by gender and year.

GCSE Subject Treemap

Link to interactive graphic

Percentage of grades by gender

Split by gender and grade – you can see that girls’ entries achieve higher grades than boys’. As widely reported, 8.3% of entries from girls achieved an A* compared to 5.3% of entries from boys. The interactive graphic allows you to filter by year.

Grades for entries by gender

Link to interactive graphic

Change in the percentage of entries achieving each grade

This graphic demonstrates that the percentage of entries achieving top grades has fallen between 2012 and 2013. The interactive graphic allows you to filter by gender.

Change in grades for entries

Link to interactive graphic

Results per subject

For each subject, we have a breakdown of the percentage of entries achieving each grade – for example 16.6% of Chemistry entries achieved an A* compared to 9.8% of French entries. The interactive graphic allows you to filter by gender.

Results per subject

Link to interactive graphic

This was a fantastic opportunity to for me to brush up on my Tableau skills and play with interesting and insightful data. Happy to hear comments on how I can improve my work or further areas I can explore.