Curvy Reference Bands in a Scatter Plot

AvatarPosted by

For this month’s #sportsvizsunday challenge I created this scatter plot on shot efficiency, goals, and shots on goals of NHL’s TOP 25 all-time points leaders.

Key elements here are the reference bands indicating goals shot by a player in a season as the product of shots on goal (x-axis) and shot efficiency (y-axis). These reference bands add a fourth dimension to the scatter plot beside the two axes and the size of the bubbles, visualizing games played in the corresponding season. A nice technique to add context to your visualization.

I’ve blogged about reference bands in scatter plots (first created in Tableau by Rody Zachovic) before, but without describing the steps to create the reference band data and to implement the bands in the view step-by-step.

Creating the Band Data

I created the data in Excel. Feel free to download the file I’m going to describe in the next paragraphs here.

Create Line Data

The lines I want to draw represent the results of a multiplication of shot efficiency and shots on goal. Therefore, I took one of my dimensions (shots on goal), set the number of goals (19, 20, … , 100), and calculated the shot efficiency as the dependent variable.

Create Bands Data

To create my bands data, I copied the line data in a first step.

For the copied data, I then deleted the last line (Goal = 100).

Next steps are to sort the copied data by goals and PointOrder in descending order…

…and to calculate the new PointOrder in the copied data.

This data creates bands for goal ranges from 10-20, 20-30, … , 90-100.

Furthermore, I had to add the coordinates to complete the first “band” from 0-10 goals manually.

In the last step, I brought everything together, the original line data, the adjusted copy of this line data and my three records to complete the first band.

Implementing the Bands in the View

Creating the bands in Tableau was quite easy using my four columns from the dataset we’ve just created.

To implement the bands into my scatter plot, I first created an image.

I then leveraged this image as a background image in my scatter plot.

Make sure to fix the axes at the same values in both your visualizations, the bands viz and the scatter plot itself.

That’s it!

I hope you enjoyed reading.

Klaus

Leave a Reply