March 31, 2016
Dear Data Two | Week 48: Sleep
For week 48 of Dear Data, Giorgia and Stefanie focused on eavesdropping. Tuesday came along and I had no data. So I reached out to Jeff and he was struggling with the topic as well. We punted and decided to look at our sleep. We hadn’t had this as a focus yet, so off we went.
The data collection for me was pretty simple. I logged into my Fitbit account and downloaded all of my sleep data since Dear Data Two started. I complain about my sleep to Beth on a regular basis and she’s convinced that I don’t sleep well because I think too much about not sleeping well and overanalyze my sleep data. Surely there’s some bit of truth in there, I mean, wife knows best, right?
Here’s what I learned this week:
- I need to get more sleep.
- Tableau conferences are absolutely horrific on my sleep (and I know I’m not the only one).
- Sleeping while on transcontinental flights will always result in poor sleep efficiency.
- I rarely ever hit my sleep goal during the week. Clearly I need to get to bed earlier since I wake up early.
Below you can walk through my analysis and see my postcard. Enjoy!
March 30, 2016
Converting Eastings and Northings into a Tableau Transport for London Bus Route Finder Using Alteryx
Today my son Oscar came to work with me to spend time with the Data School and give them an assignment. He asked them to download the Transport for London data and find something interesting. I paired Oscar with Ben Moss and they wanted to look at the busiest times for busses. Oscar will publish his work on his Tableau Public profile when he’s done.
Oscar then wanted to take the bus route information and plot the routes on a map. The data include eastings and northings and we need to somehow turn these into points on a map. Tableau doesn’t understand these as geographic dimensions, but fortunately Rob Suddaby had just written a blog post on how to do this with Alteryx.
Super duper simple!!
March 29, 2016
Tableau Tip Tuesday: How to Calculate the Number of Profitable Days per Month
This week I begin what will hopefully be a series of videos and tips about Level of Detail (LOD) expressions in Tableau. The more I teach them, the more I learn about them. Many of the example I’ll show will come from the Tableau Community and/or adjusted to expand on the exercise. Essentially, I hope to turn this into a set of use cases for LOD expressions.
This week I show you how to calculate the number of days each month that were profitable. This started with read this post on the Tableau blog. I’ve extended their example to include sparklines, an area chart and using a parameter. Enjoy!
March 27, 2016
Makeover Monday: Will a sugar tax have an impact on childhood obesity?
Chancellor George Osbourne recently announced that a tax on sugary drinks is to be introduce in the UK. This has been a long-denated issue in the States as well. Are companies like Coca-Cola and Pepsi responsible for the childhood obesity epidemic or should parents be held more responsible? A "sugar tax” is one way the government is hoping to make a dramatic impact, yet there is no sign of anything being done to educate parents. The BBC published this viz to show how people in the UK get their added sugar:
For my Makeover Monday of this viz, I walk you through the step-by-step approach I took. I start with what works and what doesn’t in the original, then as you click through the points you’ll see how I iterated until arriving at my final version. Enjoy!
March 23, 2016
Makeover Monday: From WTF to Wow!
Tonight Eric Hannell invited me to speak at the data+visual meetup he runs here in London about Makeover Monday. I’ve been doing makeovers since my very first blog post in August 2009, yet this was the first time I’ve actually spoken about the project, why I do it, the goals, why Andy Cotgreave and I joined forces, and the impact it’s having on the data visualisation community.
This meetup group isn’t a Tableau meetup; it’s about data visualisation, making it great way to meet many new people. For nearly everyone, this was their first exposure to Makeover Monday and, even for many, their first data viz meetup. My favorite part was, of course, the Q&A. There were questions about how decide what to makeover, how we make design choices, my favorite vizzes, etc. I think there may even be some new participants this week, despite it being a bank holiday on Monday.
So. Much. Fun.
You can flip through the slides below and get a good feel for what I talked about. Enjoy!
Dear Data Two | Week 47: Smells
Let’s get straight to the point…London, you stink! Between your smokers, your trash, and your stinky commuters you need to slap on some deodorant!
For week 47, I tracked every smell or scent that I really noticed. Clearly other London smells really bad or I only notice the bad smells. How can only 1/3 of the things I smell be positive? Really, I think it’s that there are so many smokers that sets me off.
On the positive side, 85% of the food I smelled was nice. But dang, that stinky fish someone was cooking in the office was god awful. Why would someone microwave salmon? So gross! I went down to Brighton for a half marathon over the weekend and, not surprisingly, I really enjoyed the smell of the sea, the fresh air, the not-so-polluted part of England.
For inspiration this week, I looked at Giorgia’s postcard.
Her shapes reminded me of noses, so I found a nose icon and created a panel chart view, which I think turned out quite nice. This was definitely what I wanted to take over to the postcard, yet there was no way I had the talent to draw 45 noses. Off I went to the stationery store to look for a stencil. I couldn’t find a nose stencil, but I did find a cool 3D stencil. So I created 3D ovals and added a bunch of other information for context.
Fortunately Jeff isn’t colourblind, so I stuck with a red/green palette to signify good vs. bad smells. Flip through the story points below to see how my week turned out.
March 22, 2016
Tableau Tip Tuesday: How to Create Small Multiple Line Charts
For this week’s Tableau Tip Tuesday, I show you how I created the small multiples line chart of the race for the Republican presidential nomination. These charts are also known as panel charts. These can be quite tricky to make as sometimes you have to play around with the scope of your table calculation to get it quite right. This video should certainly get you started in the right direction.
Here are the two calculations you need to create the column and row dividers:
Column Divider
(index()-1)%(round(sqrt(size())))
Row Divider
int( (index()-1)/(round(sqrt(size()))))
March 21, 2016
Makeover Monday: Women's Rights Around the World - An Interactive Graphic
Wow! This week’s Makeover Monday was a really tough data set. I struggled to come up with something that I thought communicated effectively. I had an idea in my head, yet when I tried to execute that idea, it simply didn’t work.
But first, let’s take a look at the original graphic from the Guardian Datablog.
What works well?
- The interaction is fantastic.
- It’s colourful, which captured my attention immediately.
- I really like the pop up list of rights you see when you click on a specific bar.
What doesn’t work well?
- There are way too many colours.
- Arranging the countries in an arc makes it difficult to compare countries. For example, the United States is on the outside, which automatically makes it look larger than any country farther inside the circle even though they may take up the same percentage of the arc.
- The equal scaling makes no sense at all. Why would you want to scale them equally?
- Does the population scaling scale by total population or female population?
- Comparing countries across women’s rights is basically impossible.
I started with the idea of a long infographic and quickly realised that this would hinder the interactivity I was after. If I want you to compare countries, then I should have them all in a single screen. I then thought about creating a bump chart. Here’s the result of that…not so good!
Back to the drawing board I went. I knew I wanted to include a few things in particular:
- A way to filter by region
- A way to show and compare all countries within a category of women’s rights
- A map to display possible geographic concentrations
- Emphasis on the countries that are performing worst
- Interactivity, like the original, that displays each question and if the criteria is met
- Action filters where it makes sense
- Simple instructions
For my viz, I also made the assumption, for the sake of time, that Yes responses were the only positive responses. Given all of those criteria, here is my submission for this week’s Makeover Monday. Enjoy!
March 17, 2016
Dear Data Two | Week 46: Books I Own
For week 46, the topic was books we own. This feels like the first week in a while that I haven’t had to really keep up with logging data on the fly. I simply took my computer to the bookshelves around the house and entered the titles of the books. From there, I searched for each book on Amazon to get the author, pages, physical size and category.
When I started exploring the data, the first thing I noticed was that I was missing a lot of books, especially many of my data viz books. They must be in a box somewhere because there’s no way I would have left them in storage in California. Anyway, I digress.
For the books that I actually have, I have at least cracked the cover on all of them. I was really surprised at how many I haven’t finished. With data viz books, I don’t generally read them cover to cover. I flip through them and read the bits that I want to learn more about. But still, I haven’t even made it completely through so many of them.
For the fiction books, which I used to read a ton of, the average page length is 592 pages, whereas it’s 168 for those I have read. Perhaps it’s harder for me to concentrate long enough to read an entire book. I wonder how true that is for other people. Is it a sign of the digital, fast consumption age we now live in?
On the postcard, I placed the books on two shelves according to whether I read them or not. I then ordered them by their physical height, marked them as either read or unread, then went through and thought about which books I would most likely recommend and which books I refer back to often.
As I finished the postcard around 6pm, it was started to get dark, so I ran down to the postbox so I could get a picture and the postman had just taken the mail. He graciously waited while I took a picture of me dropping it in the post (for Instagram). We then got into a discussion about to googly eyes on the postboxes. Apparently some of them even have noses!
Flip through the story points below to see more about what I think about my books and to see the postcard.
Tableau Tip: How To Create a 100 Mark Unit Chart inside of a Tooltip
This is a guest post from Rody Zakovich. Rody has been a very active participant in Makeover Monday and seems to have really kicked on with his curiosity in “making things work” in Tableau. Yesterday he posted this Tweet:
I immediately invited him to write it up as a guest post here. Give Rody a follow on Twitter and thank him for all of his great contributions.
Tableau 9.3 is almost out, and it’s bringing with it a lot of awesome features and improvements. BUT, it looks like we’re still going to have to wait a little longer for the bomb diggity VIZ IN TOOLTIP feature to be released. All hope is not lost though, there are ways we can “visualize” data in tooltips now, it just takes some creative thinking.
Some readers may already be familiar with how to create visualizations in tooltips thanks to Andy Cotgreave’s post from back in September of 2010.
Tableau supports ASCII Unicode Characters as strings. By using 3 calculated fields, you can create sub-strings of Unicode blocks to mimic a horizontal bar chart.
- A calculated field/parameter containing a series of ASCII Unicode Blocks : [BAR]
‘▮▮▮▮▮▮▮▮▮▮▮▮▮▮▮▮▮▮▮▮’ - A Calculated Field that determines the % of Total Value : [% of Coffee Sales]
ROUND( (SUM(COFFEE SALES) / SUM(SALES)) * 20 ) - A Calculated Field that returns a Substring of the Unicode Blocks based on % of Total Value
LEFT ( MIN([BAR]) , [% of Coffee Sales] )
I’ve used this technique a lot, and it works really well for adding additional context. It can even be used as a way to slowly move heavy Excel readers over to data visualization.
Creating a 100 Mark Unit Chart follows this same basic idea.
Step 1:
Create the Grid of ASCII Characters in a Calculated Field. This example uses a 5 X 20 matrix, but you can use whatever scale you want (You will just need to change the calcs below accordingly).
[100 Mark Unit Chart]
'▮▮▮▮▮▮▮▮▮▮▮▮▮▮▮▮▮▮▮▮' + CHAR(10)
+ '▮▮▮▮▮▮▮▮▮▮▮▮▮▮▮▮▮▮▮▮' + CHAR(10)
+ '▮▮▮▮▮▮▮▮▮▮▮▮▮▮▮▮▮▮▮▮' + CHAR(10)
+ '▮▮▮▮▮▮▮▮▮▮▮▮▮▮▮▮▮▮▮▮' + CHAR(10)
+ '▮▮▮▮▮▮▮▮▮▮▮▮▮▮▮▮▮▮▮▮'
The CHAR(10) serves as a Line Break, holding the structure of the Matrix. You can press ENTER instead of using CHAR(10), but be aware that pressing ENTER in a calculated field creates Two additional ASCII Characters in your String Field, whereas CHAR(10) only creates One.
Step 2:
Since CHAR(10) creates an additional character each time it is used in the Matrix, we need to create a calculated field to adjust for it. This allows us to get the proper number of characters needed in the Substring calcs used later.
[Adjustment]
IF [Your % of Total Calc] <= 20 THEN 0
ELSE (FLOOR([Your % of Total Calc] / 20))
END
Step 3:
Create the Substring representing [Your % of Total Calc]. This would be the Total number of Units you want to Highlight in your Tooltip.
[Left Mark]
LEFT([100 Mark Unit Chart], ([Your % of Total Calc] + [Adjustment]))
Here we take a LEFT substring of the [100 Mark Unit Chart] by the length of [Your % of Total Calc] + [Adjustment]. For example 23% breaks down as
▮▮▮▮▮▮▮▮▮▮▮▮▮▮▮▮▮▮▮▮ + CHAR(10) => 21 Characters in first Row
▮▮▮ => 2 Characters remaining from 23 [Your % of Total Calc] PLUS 1 for the adjustment
=> 23 Marks visible, 24 Marks actual
Step 4:
Create the Substring that represents 100 - [Your % of Total Calc] (The units you don’t want to highlight in the tooltip)
[Right Mark]
RIGHT( [100 Mark Unit Chart], ( 104 - ( [Your % of Total Calc] + [Adjustment] ) ) )
Here we take a RIGHT substring of [100 Mark Unit Chart] by the length of the string ( 104 ) minus [Your % of Total Calc] + [Adjustment].
This is the same as the Step above, except we work from the End string and find the number of characters not represented by [Your % of Total Calc]
Step 5:
Once you have the calcs setup, you just need to place the [Right Mark] and [Left Mark] Calcs side by side in the Tooltip, and color them as you like.
<ATTR(Right Mark)><ATTR(Left Mark)>
And that’s it! Now you can have dynamic Unit Charts right there in your tooltip.
Here’s the great news, as you can tell from the image above, this technique doesn’t have to be limited to the tooltip (i.e., it still has a purpose once Viz in Tooltip is released), you can use it on the Text Mark as well. Take for example the image below. The dashboard is actually just one crosstab containing a single Dimension on the Rows Shelf, but we can create the appearance of a 100 Mark Unit Chart.
Click on the image view in Tableau Public |
I hope you enjoyed reading this, and picked up a few tricks along the way. If you have any questions, or need further explanation, please feel free to reach out to me anytime on Twitter (@RodyZakovich) or by email at RodyZakovich@gmail.com
Regards!
Rody Zakovich
March 16, 2016
Can Anyone Stop Trump in the Race for the Republican Nomination?
As the race for the Republican nomination slowly drags us towards the scary place that is Donald Drumpf, I thought I would take a look at how the candidates have trended in the opinion polls. This post was inspired by this viz from FiveThirtyEight. They used a trellis chart to show all of the candidates and I’ve been wanting to learn how to build these charts.
Big shout out to Graeme Wiggins for helping me make my trellis calculations much simpler and dynamic so they resize based on the number of candidates. I’ll create a video for how to create these charts in a future Tableau Tip Tuesday. This was quite tricky to build.
The FiveThirtyEight viz is really good, but in my version I wanted to include more:
- All of the polls and an option to filter to a specific poll
- Choose between the average of the polls or a 2 week moving average
- Filter out the candidates that are no longer in the race
- An additional view that allows you to compare polls
The Data School Gym - Sort and Filter by % of Total
A new week means another challenge in the Data School Gym. This challenge came about because Nai Louza had a tough calculation she needed help figuring out. Here’s the final result you should produce:
Click on the image for a larger version |
Requirements
- Build a stacked bar chart that shows % of total sales for the East and West within each Product Sub-Category
- Sort the bars by the % of total sales in the East
- If you reorder the Regions, the sort should switch to the % of total sales in the West
- Provide a method for the users to pick how many product sub-categories they want to include
Hints
- You can do this with table calculations. You do not need to use LOD calcs.
- For the sorting, you have to figure out how to sort by only the value of the East (or West if you change the order on the color shelf).
- The Top N filter you see above is NOT a parameter.
You can find the final solution that I created here. Don’t cheat. Try to figure it out before looking at the solution. Reverse engineering is such a great way to learn.
March 15, 2016
Tableau Tip Tuesday: How to Create a 45 Degree Reference Line
This week, I show you how to build a perfect 45 degree reference line. I used this technique last week when I wrote about female vs. male literacy rates as part of the Data School Gym challenge. In the video, I take you through three examples in different data sets to hopefully give you different ideas for how you may use this.
March 14, 2016
Makeover Monday: How Has the Perception of Corruption in Africa Changed?
This week’s Makeover Monday was a look back at one of my very first Tableau Public visualisations. I had been using Tableau for a couple of years and obviously my dashboard and storytelling skills were not all that great. This dashboard is a good example of what I see in so many corporate environments. It looks pretty at first glance, but it basically useless. Click on the image below to interact, but you won’t be heading for an exceptional experience.
What works well?
- Map is simple and easy to understand
- Nice interactivity
- Filtering allow the user to drill is to an area of interest
- Simple layout
What could use improvement?
- Colouring the countries red/green won’t work for the colour-blind
- Sizing the dots by the CPI hides the most corrupt countries
- Drop down filters would work better than sliders
- Table content is available in the tooltip; What value is the table adding?
- No time-series anywhere to show changes
- No cohesive story to the viz; What insight can the user gain through this viz?
I spent several hours on this makeover. I wanted to:
- Find something interesting in the data
- Tell a more compelling story
- Incorporate the change since 2012
- Include some sort of time-series
Given all of the above, since so many of the most corrupt countries were in Africa, I decided to focus my story there and present it in infographic form. You can click on the image below to interact. In the interactive version, you can click on a country to highlight it throughout.
March 13, 2016
Dear Data Two | Week 45: Apologies
Apologies - something I’ve always struggled with. I know I should apologize more and be more sincere when I do. So when week 45 rolled around, I saw it as a time when I could make a change. Week by week, Dear Data Two has made me more conscious of my behaviour and surroundings. Going into this week, I really wanted to make a change in my behaviour, but I feel that I failed.
Through the week, I only recognized 18 times when I had the chance to apologize. That doesn’t feel like many to me, but maybe it is. Of those 18, I only apologized in person nine times. I resorted to sending a digital apology five times (so impersonal and insincere) and three times I didn’t apologize at all, keeping the apology in my head, fully aware that I had a moment in front on me that I could take advantage of.
I immediately knew that I wanted to create a bump chart both in Tableau and for the postcard, but I struggled with this more than I thought I would. I ended up creating the data needed to rank the dimensions in Excel instead of spending too much time on the table calculations. I added a parameter so I could pick the dimension I wanted to color the lines by. Click on the image to interact with the Tableau version.
March 10, 2016
The Data School Gym: How do Female and Male Literacy Rates Compare Across the World?
Today’s test was inspired by this blog post from John Mathis in which you have to create a 45 degree reference line to aid in the analysis of comparing two groups. If you’d like to take the challenge, you can download the data here and here are the requirements:
- Show female vs. male literacy rates on a scatterplot
- Include a dot for each country
- Create a 45 degree line so that you can clearly see which group has the higher literacy rate
- Color-code the dots to indicate whether females or males have a higher literacy rate
You can download my workbook below to see how I created it, but give it a go on your own before you look at my solution (or John’s).
March 7, 2016
Makeover Monday: How Safe Are You at Your Local Fairground?
Over the next two weeks of Makeover Monday, we’ll be taking a look back at visualisation that Andy and I did in the past that we would do differently today. One of the most fun aspects of this is it helps us see how far we’ve come in our development, and it also helps the community see that we’re not perfect. We make lots of mistakes and have done poor vizzes in the past.
This week we look back at this viz Andy created in 2010 about fairground injuries. Click on the viz to interact with the original.
What works well?
- Clearly organized
- Simple and easy to understand
- Includes interactivity (more on this below)
- Clear titles
- Distinct colours
What doesn’t work well?
- When you click on a year, the accidents chart doesn’t re-sort
- Clicking off the year doesn’t reset the accidents chart
- Fatalities are so small they are hard to see
- Year labels rotates sideways
Last week at the Data School, we watched Andy Cotgreave’s talk entitled "How Data Storytelling Can Enhance the Way You Communicate?” and in this session Andy talked about vertical vs. horizontal visualisations as a method of storytelling. I’m doing my best to use Makeover Monday to help me develop my design and storytelling skills, so this week I wanted to created a vertical story.
March 3, 2016
Dear Data Two | Week 44: Distractions
For week 44, I tracked all of the things that distracted me. The data I collected included:
- When did I get distracted?
- What was I doing at the time?
- What distracted me?
- How long was I distracted?
When doing the analysis in Tableau, I started doing what I always do by building lots of different views. I started with how many, but there weren’t any days that were massive outliers. When looking at how long I was distracted, there was a big outlier on Wednesday. That was because we had Caroline Beavon teaching in amazing data visualisation class at the Data School and she introduced us to an infographics design tool called Piktochart. This is when I distracted myself. It was fun to play with and got me thinking more about design.
I built several more views looking at the different dimensions against the different measures. Nothing particularly exciting…until I built a bubble chart in which I colored the bubbles by whether or not social media was the distraction.
I generally have a disdain for bubble charts, but this particular view helped me easily see how often social media is a distraction. Does this mean I’m on my phone too much? Probably!
The view above simply looks at how often, meanwhile looking at the bubble chart by how long the distractions lasted makes social media distractions look not so awful.
Lastly, I needed to find a view that would allow me to incorporate all of the dimensions along with the length of each distraction into a single view. I came up with this viz:
Here are some of the design decisions I made:
- Show the day of the week left to right
- Inside each day, show the distractions in order from first to last going left to right
- To show what I was doing and what distracted me, I wanted to go with the idea of going from something to something else. I ended up with filled circles inside open circles. The open circle is what I was doing; the filled circle is what distracted me.
- Create groups of activities and distractions so that there aren’t too many colors
Lastly, I liked what Stefani did for her week 44 with the lines, so I tried to do something similar with my postcard version while maintaining the view I created in Tableau.
March 1, 2016
Tableau Tip Tuesday: How to Display the Top N and Retain the % of Total
This week’s tip was sparked by a question that Jules Winceslaus of the Data School asked during a project we worked on last week for a customer. He created a bar chart that showed the percent of total, yet when he filtered the dimension, he wanted the original percent of total to remain. That is, the bars shouldn’t be recalculated based on the filter.
In the video and example below, you’ll learn how the rank function can be used to filter the results in the view without impacting the percent of total calculation.