Data Viz Done Right

March 29, 2017

Workout Wednesday: Benford's Law

6 comments
From Wikipedia:

Benford's law, also called the first-digit law, is an observation about the frequency distribution of leading digits in many real-life sets of numerical data. The law states that in many naturally occurring collections of numbers, the leading significant digit is likely to be small. For example, in sets which obey the law, the number 1 appears as the most significant digit about 30% of the time, while 9 appears as the most significant digit less than 5% of the time. By contrast, if the digits were distributed uniformly, they would each occur about 11.1% of the time.
This leads us to the Workout Wednesday week 13 challenge. Let's build a chart about Benford's law based on the World Indicators datasource that comes with Tableau. You can download it here.

Here are the guidelines:

  • Data should reflect 2010 only
  • User should be able to pick between the eight metrics you see listed
  • Zeros and nulls should be excluded
  • Match my title and subtitle exactly
  • Match my colors throughout
  • Each bar represents the % of countries that end with that number for the metric selected
  • No tooltips
  • Labels for the bars should be on the inside-top of each bar
  • The lighter blue bars behind the red bars indicate the "expected" outcome of Benford's law. Notice those don't change even when the user changes the metric.
  • Dashboard layout is 800x600
  • You cannot use LOD expressions

This shouldn't be too terribly challenging. For me, it was fun to learn about what Benford's law is and see it in action. Good luck!

6 comments :

  1. Sir, I'll be grateful if you provide the data in excel/csv format? I'm on public version.

    Thanks,
    Mahfooj

    ReplyDelete
  2. This was great! Generally not too hard but I had to Google for the bit you'd expect, and I didn't figure how to create custom colours on a reference band. The most interesting part was Benford's Law itself and seeing the way these distributions all pretty much fitted within it.

    ReplyDelete
    Replies
    1. Glad you liked it Charlie. Learning about Benford's Law was quite interesting. I hadn't heard of it before. As for the colors, I used a custom color palette that's in my preferences file. It's a discrete color palette from white to blue based on the Facebook brand guidelines.

      Delete
  3. Great workout, lots of things I don't often do. Especially the part with the white labels at the top of the bars. I ended up watching a video from you on Youtube to figure it out. Using a gantt chart. Your workbook doesn't do that though, can you point me to how you did it?

    ReplyDelete
    Replies
    1. Hi Ben. In this case, I used a reference line at the cell level and placed the label center and below the ref line. I then made the ref line transparent.

      Delete
    2. Ahhh, tricky tricky. That makes sense, Thanks!

      Delete