Data Viz Truly Can Blow You Away
Post title pun aside, when you bring Alteryx for data blending & advanced analytics, Tableau for the visual component, and Mapbox for custom maps into your data project anything is possible.
While sitting at home last week listening to the storm outside, hoping the roof would still be attached by morning, I took to Google to find data for hourly wind speeds in the UK. No dice. What I did find was an open weather API openweathermap.org which produces some fantastic live weather data from around the world. After some data capture I managed to produce the following dashboard, read on if you want to know how it was done.
Get the Data
Tableau doesn’t natively connect to custom APIs let alone live ones which leaves two choices for capturing the data. The Tableau TDE API or our favourite data blending & advanced analytics tool Alteryx. For this project I went with Alteryx simply for speed and the ability to easily schedule the process using Alteryx Server.
The Aleryx app takes a list of cities from my SQL Server, queries each one in turn against the API and then assembles the results back to the SQL database. There are three different XML parse tools in play as the XML returned by the API has a number of layers with each parse tool dealing with a different layer. The results are then assembled back into the SQL database for analysis by Tableau.
Tell the Story with Shapes
There really are only 2 primary pieces of information relating to wind, speed & direction. Speed’s no problem to encode in Tableau and in this example I made use of both size and colour, the larger and more purple being greater speeds. But what about direction? Clearly arrows are a great way to express direction but without an angle/rotation shelf in Tableau another solution was needed.
When trying to figure out how to tackle these problems in Tableau I start to look at what I haven’t used on the marks card. I could switch to the polygon mark type, and effectively draw what ever I like, but that seems like overkill especially when that shape shelf is sitting there unused. The challenge is how to get the arrow to rotate, at at least look like it’s rotating.
Back when I created a viz to compare the ratings of Larry King vs Piers Morgan I decided to show an image of every guest…all 477 of them! Now assigning them one by one simply wasn’t an option so I had to use the assign palette function, what’s key is that Tableau assigns each shape in turn and also lists the shapes in alphabetical order. So if you can get the shapes palette in the same order as your data you can in effect assign 360 rotated arrows to their corresponding angles.
So how did I go about creating 360 rotated arrows? Again taking to Google and I found the command line image editor ImageMagick for which I wrote a bat script to incrementally rotate the arrow and save the output to a new file. Boom, 360 rotated arrows that can now be assigned to the wind direction.
Take Mapping to the Next Level
About a month ago we announced our latest partnership with map delivery experts Mapbox. Amongst other things the new capabilities brought to Tableau mapping via Mapbox are a fully customised map palette and custom mapping layers. Within a few minutes I’d created a map which becomes part of the dashboard by matching the ocean colour to the dashboard background.
Thanks also to a well timed email from Paul Chapman (@cheeky_chappie) I had a shapefile of flood alert areas in England to add an extra dimension to the storm analysis.
Best of Breed
Working with (or for) The Information Lab today means being able to take advantage of three awesome, best of breed companies each bringing together everything you need to complete your data viz project.
Want to know more about any of the technologies mentioned in this post? Get in touch firstname.lastname@example.org