September 23, 2014

Facebook Jeopardy: My users are creating spaghetti charts and I might hurt someone!

First, thank you to everyone that made it to our session at #DATA14. This was one of the most fun presentations I have ever given. We hope you enjoyed it as much as we did.

This is the first in a series of six blog posts from the Jeopardy questions I answered.  Bryan will be posting his solutions on his blog.

To start, here is a video of the final solution:



And here is an interactive workbook for you to play try it yourself. There are two basic rules in this example:
  1. If five or fewer countries are selected, show each country individually.
  2. If more than five countries are selected, show a summary.

Now let me walk you through how I did this.

September 22, 2014

My week at #DATA14 in photos

#DATA14 was nothing short of incredible. In the past, I have regretted not taking more pictures with people I know, so this year I vowed to do better. I pestered people, hopefully not in a creepy way, for their pictures with me. So, here's an album from my week.

Enjoy!

Monday Makeover: Foursquare Swarm Leaderboard

As I do every day I arrive at work, I check-in with Swarm (Foursquare's check-in app). When you check-in, Swarm will often presents you with a leaderboard. Today's leaderboard looked like this:


Seems innocent enough, until you look at the numbers relative to the size of the bars. In the Swarm chart, the bars are definitely not proportional. For example, Russ has 18 check-ins, but it looks like he has more than half of my 38. Troy has 1, yet it looks like 25% of my check-ins.

If the bars are sized properly, the chart would look like this:

When the bars are the proper length, you get a much different view. I'm surprised that Foursquare would make such simple mistakes. Perhaps they are trying to force the text inside the bars and that's causing the problem. Whatever the reason, it shouldn't be done.

September 18, 2014

The Sleeping Habits of Tableau Zen Masters

The feedback was so positive from my viz of the sleeping habits of geniuses that I had to give it another go. This time, I take a deeper look at the 2014 class of Tableau Zen Masters. Surely this group meets John Medina's requirement of 8 hours of sleep, right? Absolutely not! In fact, only 40% of them get more than 7 hours of sleep.

I blame Tableau. Clearly the Zens spend too much time playing with Tableau and helping people solve the hardest Tableau problems. Judge for yourself with the viz below.
  • Hover over a Zen and a summary of their stats will appear on the right.
  • Hover over a Zen for links to their Twitter profile and website.
  • Rank the Zens using the parameter on the right: By amount of sleep, when they go to sleep, when they wake up in the morning or look at a simple alphabetical list.
  • Use the minimum sleep parameter to determine how much you think a Zen needs to sleep and watch the viz update.

Download the data here and the workbook here.

September 15, 2014

Makeover Monday: The Sleeping Habits of Geniuses

In the Thursday opening keynote at #DATA14Dr. John Medina discussed some incredible insight about how sleep affects our brains, productivity, etc. This made me think about this visualization from New York Magazine that I use when I teach data visualization. I use this example in the constructive criticism part of the class.
There are so many problems with this display.  A few of them include:
  • The background shading of the night time and day time.
  • The curved nature of the display, which makes people on the outside appear to sleep longer than those on the inside.
  • The pictures of only some of the people aren't necessary.
  • There's no apparent order to the people.
Those are just a few of the most immediate problems. I thought I would show two examples of how I would make this over. In every class that I've taught, the class comes up with something very similar.

First up is a Gantt chart view. This view is ordered by the most sleep to the least sleep and color-coded by those that get at least eight hours of sleep (the minimum amount according to Dr. Medina).


NOTE: I added the background shading from 10pm-6am after the original post based on feedback from Steve Wexler.

If you'd prefer not to see it in a timeline view, but rather by a simple list from the most sleep to the least sleep, this bar chart would likely suffice.


If you'd like to create an alternative view of your own, you can download the Tableau workbook here and/or the data here.

September 8, 2014

Use Axis Rulers for cleaner charts in Tableau

Last week I was talking with Paul Mathewson of Interworks about a bug that he was seeing with axis borders in Tableau. I thought I was seeing the same bug, but it turns out that mine was different. On my bug, there were some charts on which the axis border would not appear. I hadn’t changed any settings and some other charts that had the same exact design worked just fine. So I turned to a feature that I’ve never used in Tableau…Axis Rulers, which is a feature I cannot find documented anywhere on Tableau's website.

While Paul and I were chatting, he showed me a neat trick he uses to make cleaner charts. He learned this trick from Gabriel Gejman, who learned it from John Abdo. This is how things work in the Tableau community; one person finds something and others spread the word. I’m writing this blog post to share as well.

By default, Tableau includes the gridlines when your date dimension is continuous. You also get that border around the whole chart. Now consider this cleaned up version.


To get this view, all you have to do is make some simple formatting changes. First, format the borders by setting the Pane to None for both the Row Divider and the Column Divider.


Next, go to the Format Lines options and set the Grid Lines to None.


Your chart should now look like this:


The last step is to go back to the Format Lines options and set the Axis Rulers to a line and make them a light gray.


That’s all there is to it! You now have a super clean line chart.


Put several of these together on a dashboard and you really see a big difference.


Download the sample workbook here.

September 3, 2014

Premier League summer spending was out of control - A Story

Tonight while I was running and listening to the 5 Live Football Daily podcast, I heard a very interesting stat: Premier League clubs spent more on summer transfers than the GDP of 14 countries. This sounded too crazy to believe, so I made a mental note to look into it after I got home. I spent the better part of the rest of the evening re-hydrating and finding data to tell the story you see below about the insanity that is Premier League transfer spending.

I created most of the charts you see on my commute into work on the shuttle and polished it up after breakfast. What was most fun about creating this story was the process itself; I went from idea to data to vizzes to story in a very short amount of time.

My advice to you: If you hear an interesting fact, look into it.  Find some data. Tell the story in your own words. It's a great way to practice and develop your craft.

September 1, 2014

Makeover Monday: Where We Donate vs. Diseases that Kill Us

One of the ways that I can tell I've made an impact on people I've interacted with is when they send me links to terrible visualizations that they want me to makeover, long after we have worked together. My friend Karyn, who I used to work with at Facebook, send me a link last week to this infographic:

Source: IFLScience

Of course the point of this infographic is to show how much money the ALS Ice Bucket Challenge has raised compared to how few die from the disease relative to other diseases. The data is from 2011, so it doesn't account for the fact that the Ice Bucket Challenge has now raised over $100M. For the purpose of this makeover, let's focus on the chart itself. I see several issues immediately:
  1. The bubble sizes were originally based on the diameter of the circles, not the area.  This is a big mistake! The author has since fixed this so the graphic above is now correct.
  2. There are too many colors. I find myself going back and forth to the legend. It shouldn't be so hard for the readers.
  3. The colors in the legend are in no particular order; not alphabetical, not by deaths, nor not by money raised. This is way too confusing.
  4. It's difficult to trace the relationship between the deaths and the money raised. 
Taking these difficulties into account, I have created this slope graph.


Some of the benefits of presenting the data with a slope graph include:
  • We can see the ranking relationship between the cause and the disease much easier. 
  • I've highlighted the Ice Bucket Challenge since it is the focus on the article.
  • I colored the remaining line by red or blue to indicate a decline or increase in rank respectively.
  • I labeled the ends of the lines directly to eliminate the need for a legend.
One additional element that would add value to the slope graph would be to include the bubble size. If you'd like to build your own infographic, you can download the data here and/or the Tableau workbook here.

August 28, 2014

Two-way Sorting in Tableau - Sorting Some of the Viz by a Measure and the Rest Alphabetically

I had an interesting requirement posed to me yesterday that I hadn't ever run into before. I'm using this Airline Delays data to demonstrate the technique. The requirements were along these lines:
  1. Given a list of airports, there are a subset that are "targets". Let's assume they are the top 15 with the most flights in 2014: ATL, DFW, ORD, LAX, DEN, IAH, SFO, PHX, LAS, MCO, CLT, EWR, BOS, SLC, LGA
  2. The airports need to be sorted by the latest delay rate.  However, only those in my top 15 list should be sorted by delay rate, the rest should be sorted alphabetically to make them easier to lookup.
  3. Include sparklines for each airport for 2010 to present.
This is the final product and here's how I went about solving this problem. There could very well be a more efficient method, but this worked for me.

August 25, 2014

Tableau Tip: Month over Month KPI Movers

Reader Brian Bieber (no relation to Justin), a Data Analyst at Vanguard, sent me this question:
I'm currently running some monthly data where a list of records is assigned a KPI indicator like G/Y/R. I've been asked to produce a follow-up piece that would show "movers" from the prior month's data, just in a simple text view. So I guess what I need to try and do is figure out how to do a lookback/compare from prior month data to see who went from Y/R to G on the positive change side and who went from G to Y/R on the negative side.
What Brian didn't realize was that answer to his question was pretty much in the question itself; he needs to use to LOOKUP() function. I sent Brian a solution, but decided to fancy it up a bit more and add some more functionality using parameters:

The steps for building a KPI movers viz like this are pretty straight forward. I'm using the Superstore Sales data set that comes with Tableau in this example.