Craig Bloodworth

CTO

Tableau Zen Master

Local Food Enthusiast

Loading,
0
% complete
  • May 31, 16

    Hi there! This blog post is about a Tableau technique for building polygons, that I figured out in the best way: taking a good challenge!

    At first, I thought of using this technique to polygon-ize images, courtesy of the great Brian Prestidge and inspiration for the latest Iron Viz winner. However, I don’t have an illustrator license, as most of us.

    Yeah, I could have used a 15 day trial version, but it would have made it a one-shot experience: there should have been a better – and reproducible – way to do it. And there was!

    It basically involves some preparation of the image t0 vectorize it, and then this alteryx macro  to convert the image into polygons (You can also use excel for this bit, but it will take longer).

    Below I will explain step by step how to create Tableau-Ready polygons out of any image.

    The vectorization process

    First, you need to ‘vectorize’ the image, i.e. to convert it into shapes. After a quick google, I found an open source free software for this, called inkscape.

    The vectorization process in inkscape is pretty easy:

    Import the image into the software – I suggest to activate the XML Editor under the “Edit” menu;

    Select your image, and under “Path” pick “Trace Bitmap”. This is the tool that will convert your image in shapes: There are several options and algorithms available, I suggest you to try more than one, until you are happy with the result;

    Now pick the “Select Path by Node” tool from the bar on the left hand side (), go back on “Path” and pick “Break Apart”, to create a single polygon for each shape in the image;

    If everything worked fine, you should be able to select every single shape as a separate object;

    Now, do “ctrl+shift+p” to open the “properties” window, and make sure to select ‘Absolute’ as your path string format.

    This means that when you will save the svg file, the coordinates will be recorded as absolute, and not relative to the previous point. You can go ahead and save the image as SVG file.

    Because an SVG file is actually an XML file, we are ready to parse the coordinates of our polygons!

    Transforming the image into polygons

    This is how your SVG image looks like when you open it through an IDE (I am using Brackets, but you can use your favourite, or even the notepad).

    As you can easily spot, you have your image broken down into single shapes, with the relevant coordinates: “M” coordinates stand for “Move”, while “C” stand for “Curve” and “Z” close the path.

    You don’t really need to worry about the different coordinates types though, as you set the coordinates to be absolute points.

    Now, if you have an Alteryx license, you can just download this macro, open your image using an input tool and say “Read as XML”, making sure to select both Root and Outer XML.

    Plug this input in the macro, and you will have a TDE with your polygons. The macro also allows to continue the workflow, if you need to work on it adding layers of data to your polygons.

    The way this macro works is fairly simple: it basically just read the image as xml, and parse out the coordinates for each point as “X” and “Y”, the polygon identifier as “PolygonID”, and the path as “PathID”.

    You just have to make sure you have “X” on Columns and “Y” on Rows (you may also need to revert your axis), and you are good to go!

    This is my end result on Tableau Public:

    Click on the image to go to the viz.

    If you don’t have an Alteryx license, the process of parsing the coordinates from the XML is definitely longer and more painful. In the end, what you need is to parse out the X and the Y for each point of each path, and assign a continuous number (path id) to each point from 1 to the end of each path. If you copy the xml into excel, you can use a couple of macros and the Tableau add-in for excel, to help you out.

    Disclaimer: This method works for any image you are able to vectorize. Of course, the easier the image, the better the result. Ultimately if you have a complex image to polygon-ize the hard bit will be working in inkscape, until you have the right paths.

    The post Polygons to the people! Polygon-ize any image for Tableau appeared first on The Information Lab.

  • May 31, 16

    Have you ever shown a dashboard to your boss, to your colleagues, and wondered why they don’t get it? You’ve gone from cloud nine to rock bottom faster than VizQL finds tables in the east? Please tell us your story, we want to help.

    The Unlikely Bunch

    Matt Francis

    Rob Radburn

    Chris Love

    Andy Kriebel

    Craig Bloodworth

    Solving your Data Woes

    At Tableau Conference On Tour London 2016 the UK Zens will be available to help. It’s crazy simple…

    1. Buy a ticket for TC On Tour London (what better way to account for the conference fee than free community consultancy?)
    2. Submit your problem & data / dashboard using the form below
    3. Enjoy everything Tableau has to offer during this unique event in June
    4. Attend the Zen session on Wednesday 15th June at 14:45 to see how to express data in a new & compelling way

    Will the Zens do YOUR work for you? Yes! If you can make a great argument. Use the form to sell your problem & what you think the data can do to help your organisation. The more compelling the better.

    What problems can I submit?

    Here’s some examples of the kind of problems we’d love to see:

    Help me improve… give us a dashboard and your objectives and let the Zens talk through how they’d “pimp your Viz”

    Help me visualise… give us some data and your objectives and the Zens will attempt to get past “it depends” and show some ideas for the best way to visualise it

    Help me persuade… got a stakeholder with a pie fixation…. a colleague with table trouble…. if you’re looking a changing anything from best practice to data strategy in your organisation then the Zens will give their take on how they’d approach the discussion.

    Help me simplify… we’ve all gone down a data rabbit hole at some point and ended up with complex, hard to understand dashboards, the Zens will help you pull out what’s crucial and remove the clutter and noise.

    Help me learn… looking for the best resources to help you with a thorny topic that just won’t stick? Get advice from the Zens on how they learnt and how they teach.

    The best problems will be ones the whole community can learn from, so it’s unlikely the Zens will tackle “my calculation won’t work” type problems, or questions answered quickly elsewhere such as “how do I make a waterfall chart”.

    The Form

    The post What would a Zen do? appeared first on The Information Lab.

  • May 16, 16

    Back in February I posted an article regarding what I called “Tableau KISS” on my personal blog. The feedback from the community was great and I received lots of positive comments and messages, but since then I haven’t posted much in the way of follow up. Let’s change that….

    Tableau KISS

    The idea behind Tableau KISS was to show that Tableau shouldn’t have to be complex – Keep It Simple Stupid! – and that interesting, engaging visualisations doesn’t necessarily need to use edge-cases, complex visualisations or use “wow factors” to tell interesting stories. With that in mind I promised I would be revisiting some visualisations on Tableau Public to show how similar stories can be told through simple techniques, focussing on those techniques a user might learn through the Tableau Fundamentals course. Furthermore I also wanted to focus on simple story telling that anyone can understand, rather than use visualisations that require a lot of understanding.

    Revisiting Iron Viz Foodfight

    With that in mind I have decided to revisit each of the recent Iron Viz Foodfight entries and visualise each dataset in turn using only the Tableau KISS principles. Clearly each of the Iron Viz entries were done with the competition in mind, the most prestigious and most technically challenging event in the Tableau community, and so almost all contain complexities beyond Fundamentals level, therefore it will be a fun and interesting challenge to see what can be achieved without them.

    Clearly there can be no comparison between my TableauKISS visualisation and the original, I am not attempting to produce a “better” version and am in no way suggesting the original visualisations were wrong to use complex techniques (almost a must in Iron Viz!). Instead I want the focus of these articles to be on creating a new visualisation using the same data, and how I got there.

    To Bee or not to Bee

    To start on this journey I’m going to look at my Colleague Carl Allchin’s visualisation To Bee or not to Bee.

    I loved this visualisation, the story of bees was interesting and the depth of data just enough to provide a good level of detail at State level. From a difficulty perspective it certainly had nothing uber-complex, but using parameters for the highlight and also blending with the Hex Map certainly provided a level of complexity beyond a beginner.

    Creating the KISS version

    Revisualising this data with simple techniques was actually a lot harder than I expected, the state level data provided a challenge to get onto a chart without cluttering and providing too much information. I circled round and round before settling on telling the story at a national level and then allowing the user to filter to the state of their choice.

    Initially I had opted to tell the story via Story Points but instead opted for a vertical scrolling “infographic” style visualisation, click on the image below to go to the interactive version.

    How To

    Let’s look at some of the challenges I faced in putting this together.

    Index Charts in Tableau

    The four charts in this visualisation are all Index Charts – looking at the percentage change in a given measure since 2006. Creating them in Tableau is simple and simply requires the use of the Quick Table Calculation.

    1. Start with a simple line chart with Year on Columns and the Measure on Rows.

     

    2. Using the Quick Table Calculation option set up a percentage difference chart…

     

     

    3. Set the percentage difference to be calculated relative to the first year.

     

     

    Weighted Averages

    Another complexity of this visualisation was that the measures I was comparing were in some cases already State-level averages in the raw data; in other words I could not simply aggregate them to get the national picture. If you’re unsure why this is then let’s look at this example with house prices: if the average price in one state with just one house is $100k, and the average price in another state with 100 houses is $50k then the overall average price of a house in both states is not ($100k + $50K) / 2, instead it is (1 x 100k + 100 x 50k) / (1 + 100). In mathematical terms this is what we call a weighted average, because the average is weighted by the number of houses.

    In the same way my national average yield per colony (in lbs) is calculated as a weighted average at the national level:

    sum([Number of Honey Producing Colonies]*[Yield per colony (pounds)])/sum([Number of Honey Producing Colonies])

    Design

    As with any visualisation the initial engagement comes not from the story and analysis but from the design, a visualisation needs to pull in a user if it’s to really grab their attention beyond a cursory “uh-hu”. Again, fundamental techniques don’t present a problem here with a little imagination and design flair and I was able to produce what I believe is an engaging format.

    I opted for floating elements to bring the visualisation together and allow me to position the elements as I wanted, it also gave me the control I needed to be able to float bee photos over the charts and give the feeling of bees invading the users screen. Sourcing the images wasn’t too much of a problem thanks to Flickr (remember to only take images from the internet if people have allowed it and always attribute photographers accordingly) and with some rudimentary Fill tool knowledge in Snag It Editor I was able to make their background transparent.

    The overall clean design of black text and charts with yellow bees was something that evolved over time, and as with anything in design then you know when you’ve hit something you like and this was certainly the case here. My advice for new users with anything design-wise is to look for plenty of inspiration, inside and outside the data-viz world, and keep iterating designs until something works.

    Conclusion

    It was a tough job to revisit Carl’s viz, I expected it to be easier, however winding back my knowledge to the point where I only allowed simple techniques actually released me from worrying too much about complexity and instead I think focussed me on the analysis of the story and the final design. Overall I’m happy with the result, but I’d love to hear your feedback. Are you a new user? Do you think you could have created this? Where is the difficulty for you?

     

    The post Tableau KISS – Revisualising To Bee or not to Bee appeared first on The Information Lab.

  • Apr 25, 16

    Over the past few weeks, I’ve been working on my submission for the 2016 Iron Viz competition and let me say, this was PRESSURE! Note to self for future Iron Viz work: do not browse other peoples’ submissions on Twitter, it will just FREAK. YOU. OUT. Everyone’s been amazing, and whether I get accepted or not it was a great learning processes and I’m sure this year’s Iron Viz is going to be edge-of-your-seat incredible.

    The first thing I did was locate my data, and let me tell you this took 90% of my time. I spent the first few days trying to figure out what I wanted to look at, and even though I had all these awesome food-themed ideas, the data just didn’t exist or was incomplete or just not workable with Tableau. I ended up settling on the UK Family Food Dataset . I used to volunteer in a food service non-profit when I was living in Vancouver, and there were a lot of myths people held about what foods low income individuals were drawn to, how their diets were shaped, and what role alcohol played in their lives. I decided to explore some of these ideas and see how things manifest here in the UK.

    My next step was to clean the data using Alteryx in order to pull data from all income levels together, remove nulls, and just generally make things workable in Tableau. Once that was done, I imported my data into Tableau and started exploring. Although the dataset divided income levels into deciles, I decided to define high income as the top 20% of the population (decile 9 and 10) and low income as the bottom 20% (decile 1 and 2).

    The first myth I wanted to address was the idea that low income people are more likely to purchase takeaway foods because they’re cheap and quick. However, for both low income and high income individuals, takeaway foods only make up 1% of all household purchases. I originally had this highlighted as a bar chart, but because of the amount of space it took up, I settled for the more compact pie chart. I know, pie charts are the bane of data analysts’ existence, but in this case I think it works because I’m only looking at two groupings of data (takeaway food vs. other). If nothing else it is a food themed competition so… pie charts.

    I then looked at nutrition and was surprised to see that low income individuals’ nutrition was actually quite comparable to high income individuals. The only nutrient that seems to be a problem is vitamin A. A quick Google search showed that this is a common issue in developing nations and is usually attributed to a dietary lack of animal sources of vitamin A, as well as increased alcohol consumption. However, deficiency is rare in developed countries like the UK, so it doesn’t appear to be affecting people in a way that is concerning.

    I also wanted to show fruit and vegetable consumption as a percentage of total household purchases, but ended up with some bumps in my table calculation. I originally wanted to show this as a unit chart pyramid, kind of like the plate on the left in this infographic:

    I’m pretty sure my table calculations were getting messy because of the header-subheader format of the data set, so I settled on the icons with text to add some images to my viz and used another pie chart to demonstrate fruit/veg consumption as a percent of total.

    My last chart explores alcohol consumption, which is a pretty big stereotype I’ve come across about low income people. Alcohol abuse is definitely something that affects low income communities, but the stigma associated with it leads people to believe they are the only communities affected by alcoholism. The data in this case isn’t reflective of alcoholism per se, but it shows measured quantities of alcohol purchases per person per week. I was surprised to see that not only do high income individuals consume more alcohol, they consume pretty much double the amount. Wine and Champagne are also their greatest expenses, compared to milk and cream products for low income individuals.

    This dataset was not easy to work with, but overall, I’m happy with what I was able to produce. I wanted to work with something I was passionate about, and when the food theme came up it reminded me about all these discussions I’ve explored about food security, right to food, and food accessibility. It was interesting to see how things are developing here in the UK, and I gained some insight about not only the quantity of food people are consuming, but also the quality and how this is affected by income levels.

    The post Challenging Myths of Low Income Individuals and Food Consumption appeared first on The Information Lab.

  • Apr 24, 16

    The Silk Road –designed UNESCO World Heritage Site in 2014- is probably the most famous trade route in the history of the world. For more than 1600 years, its network of routes has been the main driver of goods exchanges between the West and the East, as well as the main channel of political and cultural interactions.

    Just take it in for a moment: Thanks to the Silk Road’s trade routes, remnants of Chinese Silk have been found in Egypt from 1070 BCE!

    The amazing history of this network suggests that commercial routes have never been only a way to sell and buy goods, but instead they can tell several stories of relationships, politics, culture, lifestyles, and power balance.

    Investigating its shape over time, we can appreciate the creation of economies, and the development of great civilizations as Chinese, Indian, Persian, Roman and Syrian, among others.

    So, what modern commercial route would tell us, if we could interrogate them? I found 30 years’ worth of data from the FaoStat to figure it out!

     

    Click on the picture to go to the Viz!

     

    A tale of multiple stories

    From caravans to cargo planes, our world is now wholly globalized: nowadays, nobody would be any surprised to find Chinese silk in Egypt!

    Despite the trend toward globalization, the world is still clearly polarized around three big players:

    Uncle Sam spills his (soy)beans!

    USA are both the largest exporters (by far) and the largest importers of food. Their main traded products are Oil, Meat, Sugar and Beverages (Coke, anyone?), while their imports are mainly Oil, Beverages, Coffee, Sugar and Meat.

    The most valuable commercial route is the Soybean export to China, followed by Canadian, Mexican and Japanese routes.

    The Soybean’s USA- China commercial route is really big deal for world’s agriculture, and it is somehow amazing and surprising, as soybean had actually first originated in China!

    Its relevance for the global balances has been receiving extensive coverage from commodity analysts, and researchers (see ‘China and the Soybean Challenge’ , or ‘How China’s Soybean Imports Could Affect US Exports‘), and is mostly driven by the rise in demand of Chinese people, due to their increase in their living standards.

    China imports Soybeans mostly for making vegetable oil and high-protein meals, and recently this year approved for import Monsanto’s GMO variety of soybeans.

    Besides US, in the last years another big player entered the game of feeding China’s demand of soybeans: Brazil, which – according to Bloomberg – is set to displace U.S.

    In fact, Brazil cultivation and export of soybeans skyrocketed since the early 2000, as the commercial relationships with China got stronger. In 2009, China surpassed US as Brazil’s largest trading partner (nature.org).

    Unfortunately, one of the main effects of the raise of Brazil in this market, is a huge impact on deforestation, as pointed out in several studies (e.g. here and here), and a threat to conservation.

     

    The galloping BRIC:

    The Brazil-China Soybean route brings us directly to the second main pattern of the last thirty years of food trade routes: the rise of the so called BRIC.

    Brazil, Russia, India and China are usually considered a cluster of large countries that boosted their development pace and economic growth in the last decades.

    However, a glance at the shapes of their food trade routes suggests very different effects of their growth in each country.

    For China and Russia, the growth meant mainly an increase in the demand of food, in particular the abovementioned and diffusely covered soybeans for China, and Meat for Russia.

    Brazil, instead, became the second largest exporter, mainly courtesy of its boost in commercial relationships with China, but also thanks to European and Russian demand of Meat.

     

    Good Old Europe:

    What an amazing network of diverse – and yet united – countries and people!

    Europe is homeland of six between the largest food exporters (and importers) in the entire world: Netherlands, Germany, France, Italy, Belgium and United Kingdom. The commercial routes involving those countries are mainly focused on high-end products like Meat, Wine (mainly due to Italy and France) and Beverages.

    Netherlands is the biggest food economy, exporting its products in all the EU and the US, and importing – mainly meat – from Brazil and Argentina. A fair part of its wealth is due to its strong relationship with Germany.

     

    Conclusions

    The above mentioned stories are only three among the infinite ones that this dashboard can help see and understand.

    The “New Silk Roads”, from a ten-million-rows dataset are here unleashed in a dashboard oriented toward exploration and user-friendliness.

    Explore what you are interested in, select a trade route for a particular product and see how this network has evolved, revealing shifts in global demand and power balance. Pick your favorite food, and see where it is likely to come from, but don’t forget to let me know about all the interesting things you discover!

    The post The Silk Road: What exchanges of food tell us about our world appeared first on The Information Lab.

  • Apr 19, 16

    Parameters make a viz more interactive and can be used for a wide range of functions in Tableau. You can change the dimensions that are being shown in a viz as well as change the measures that are being aggregated in the viz. So why not use parameters in LoD calculations?

    In this example I want to create a histogram that shows the distribution of quantity of items sold. I want to know how many customers fall into each quantity bin. I then want to use a parameter so I can switch to find out how many products fall into each quantity bin.

    The parameter in this example is:

    Product/Customer Parameter; 1 display as Product, 2 display as Customer

    I then need to write a calculated field (called [Product/Customer Dimension]) so that I can switch between the two dimensions:

    CASE [Product/Customer Parameter]

    WHEN 1 THEN [Product Name]

    WHEN 2 THEN [Customer Name]

    END

    I now need to create a LoD calculation to create quantity bins. One advantage about using a LoD to create bins is that you don’t need to have uniform sized bins.

    To start my LoD (called [LoD Quantity Bins]) I need to specify what dimension the calculation will be aggregated at. Here’s where I use the calculated field I just created so that I can switch between the two dimension:

    {fixed [Product/Customer Dimension]:

    Next I need to type out the different bins. The important thing to note here is that the calculation part of the LoD has to be an aggregation. Therefore the [Quantity] measure that is going to be binned needs to be aggregated:

    (if sum([Quantity]) >=0 and sum([Quantity]) <=9 then “0-9”

    elseif sum([Quantity]) >=10 and sum([Quantity]) <=24 then “10-24”

    elseif sum([Quantity]) >=25 and sum([Quantity]) <=49 then “25-49”

    elseif sum([Quantity]) >=50 and sum([Quantity]) <=99 then “50-99”

    elseif sum([Quantity]) >=100 and sum([Quantity]) <=149 then “100-149”

    elseif sum([Quantity]) >=150  then “150+”

    END)}

    What you’ll notice is that the created calculation is a dimension. This allows you to use the calculation categorically. If you drag the [LoD Quantity Bins] dimension onto the columns shelf then right click and drag the [LoD Quantity Bins]. You should now see something similar to this:

    If you add the parameter to the sheet by clicking on the parameter and selecting “show parameter control” you will then be able to select ‘Customer’ and you should now see something similar to this:

    And there you have it a parametrised LoD Histogram. Check out the workbook on my Tableau Public to see how you can take this concept further to create new, interesting ways to visualise your data:

    Paramater in a LoD

    The post Creating a dynamic Histogram using a parameter in a LoD appeared first on The Information Lab.

  • Uploads
  • Photos
  • abcdefghijklmnopqrstuvwxyz abcdefghijklmnopqrstuvwxyz
    Now Playing
    ×