Data Viz Done Right

March 15, 2016

Tableau Tip Tuesday: How to Create a 45 Degree Reference Line

9 comments

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.

9 comments :

  1. Nice! That's a pretty smart and simple to draw a 45-degree trendline :)

    By the way, I think you're double counting the number of countries in the Literacy Rate viz, due to the data points situated on the trend line. It should be 22 countries where female literacy is higher than male literacy.

    ReplyDelete
  2. Very cool to see in the video how you applied the technique to three different datasets. That's crazy-helpful and useful to see it applied in different ways. :-)

    ReplyDelete
  3. Thanks for the example. It gave me some useful ideas for some comparisons I've been trying to figure out how best to visualize. Although not the primary purpose of this example, using an aggregate function for the calculated field to determine direction of change should fix the issue for the CPI and Sales datasets. For example: sum([First Year CPI])<sum([Second Year CPI]). You could also put this into an IF statement to set values of "Increased", "Decreased", or "No Change". Alternatively you could calculate the difference between the two values and use it as a continuous measure with a diverging color scheme so the color represents direction of change and the shade/density represents how much of a change occurred between the two years.

    ReplyDelete
  4. That is very cool! Very elegant to use a trend line for this.

    ReplyDelete
    Replies
    1. Thanks Robert! It's fun figuring out these work arounds.

      Delete
  5. Great post, Andy - a very clever solution. I've posted an extension to this that allows matched axis ranges on X and Y that are dynamic. See here: https://blog.databender.net/2016/03/21/45-degree-reference-line-with-dynamic-axes/

    ReplyDelete
    Replies
    1. Excellent Alan! I really like what you've done.

      Delete
  6. Thanks Andy for figuring out these cool stuffs for us.

    ReplyDelete