Sunday 22 March 2015

Bananarama



On last week's episode of the Tableau Wanna Be Podcast with Emily and Matt, Jewel Loree shared that her go-to strategy for developing a new viz was to think of the name first and go from there. I thought I'd give this approach a shot, and for some reason the word 'Bananarama' came into my head - maybe because I like bananas or maybe because I subconsciously love 80's pop music. Who knows.

So anyway, here's a viz on the worldwide banana trade, with data taken from http://faostat.fao.org/.

The most interesting thing I see here is what's going on with Belgium - lots of bananas go through Belgium on their way to Germany.

Thursday 5 March 2015

Making 'Dieu et mon droit' and some tips for using Wikipedia data

The last viz I made, see below, was all about the history of English Kings and Queens. And the data source for that viz was a Wikipedia list page http://en.wikipedia.org/wiki/List_of_English_monarchs.

Now it just so happens that the next Tableau Public Iron Viz feeder contest is all about making something with Wikipedia data. So although I'm not going to be entering my viz, I thought it might be a good opportunity to write a few things about how it was made to show some of the things you can do with a simple Wikipedia list. And in fact if you look across my blog, you might notice that a healthy proportion of the vizes I make have taken their data from Wikipedia.


So on to the viz:

The idea came from three places. First I really wanted to collaborate with my friend Dan Miller on something. Dan is a great illustrator and calligrapher and I wanted to bring in some of his expertise to help produce a viz that contained some custom artwork. Secondly, I was feeling a bit homesick and wanted to do something with a British theme. And thirdly I was browsing Ben Jones blog and came back across this viz of US Presidents in the form of a Gantt chart which is rather excellent.

So it hit me, why not copy Ben's idea but do it for English monarchs? This would also enable Dan to bust out some sweet looking calligraphy.


So first I went off to Wikipedia to see what data they had, and as usual it was perfect for my needs and in a list form, so I just copy and pasted that bad boy into Excel




BUT..... as you can see above, the boxes contain different bits of info, e.g. the name and date of birth and death are in the same box. And also because the formatting was a bit different for each monarch it ended up kind of messy. I also found that much of the information that I needed was on the detail page about each Monarch:



I also tried some web scraping, but for the life of me I still haven't got this to work the way I want it to. So I went old school, and manually entered everything into an Excel spreadsheet.



That's right. Manual data entry.

And here's my first tip for anyone making a viz for the contest: Don't be afraid of manual data entry! Yes its very boring and yes it seems archaic - but sometimes its the only way that works for what you need, and really if you're watching tv and having a beer at the same time, its not that bad.

The second piece of data I decided to get was which countries they were the Kings or Queens of. This was painful. I put this in a secondary data source (see more below in the section about maps).

You will also see that I grabbed a picture URL from Wikipedia for each monarch. One of the things I love about Wikipedia lists is that thanks to those people who created them, there are often pictures there of exactly what you need, and they have one great quality - they can be resized!

How to resize a picture from wikipedia:

You need to do this if you want your pictures to all be the same size, and because images in the Tableau browser window do not resize once they are up on Server/Public.

A Wikipedia picture URL typically looks like this if you copy it from within the page:


http://upload.wikimedia.org/wikipedia/commons/thumb/7/77/Eadred_-_MS_Royal_14_B_VI.jpg/220px-Eadred_-_MS_Royal_14_B_VI.jpg

See that bit in bold and italics? You can change that. I changed all mine to 180px

http://upload.wikimedia.org/wikipedia/commons/thumb/7/77/Eadred_-_MS_Royal_14_B_VI.jpg/180px-Eadred_-_MS_Royal_14_B_VI.jpg


And now, although the pictures might be different shapes, they are all at least the same width.


Mock-ups

I don't normally create mock-ups for my vizzes, I usually just dive straight in, bit since I was working with Dan I first produce a 'data only' version of the viz, which looked like this:


(but without the background on the scatter plot, that came later)

I sent it to Dan and he came back with this which he mocked up:


which was starting to look pretty good. So we developed it from there. But here's where the compromises started coming in.

Backgrounds

Transparent backgrounds are not available for Tableau sheets - but we really wanted to use the distressed paper scroll look. Background images can be used, but only it seems with scatter plots, and so I had to abandon the Gantt chart (which I liked) to a scatter plot that looked something like a Gantt chart. I did this by placing the order of the monarchs in reverse (i.e. negative order) on the rows. And I couldn't figure out a way to get properly starting and ending Gantt bars, so I switched to crowns.

Dan gave me a big jpeg file with all the illustration on it and I used this as the background map.


Now the actual scatter plot on the viz I used a plain background image for because it was possible, but the bar charts I had to leave the background white. So I wrapped them all in transparent .png files of picture frames so that the borders would not be as visible or noticeable.

And then I added lots of dashboard actions. Again, a tip for folks doing a wikipedia viz - because of the nature of the data sets they lend well to exploratory vizes which are controlled by dashboard actions. And now that Tableau 9 is in play, tooltips and action responsiveness is much improved so I recommend making all actions driven from Hover.


Dual Axis Maps

Lastly, I wanted to create a map that kept England, Scotland, Wales and Northern Ireland separate, but include other countries. The default geocoding in Tableau has the United Kingdom as a whole, and England, Scotland etc... as states. So I decided to use a dual axis map to get around this and place 'State' on one axis, and 'Country' on the other and blended a secondary data source that looked like this:




Well I hope that was useful and if you are entering the contest - good luck :-)