ESPN's All-Time NBA Ranks

I recently came across ESPN's All-Time NBA Ranks list, and it made me curious about how the players in the list compare.  I wanted to be able to view all of their ranks across the five major statistical categories.  I built this visualization using parallel coordinates so that I could click on a player and easily see how they compare amongst their peers.  One caveat I must mention is that I had to remove players where all five stats weren't tracked.  That's why you don't see Wilt Chamberlain or Bill Russell in this list.

Using parallel coordinates, we are able to see "player profiles."  What I mean by this, is you can visualize the type of player by seeing their ranks across all five stats.

For example, John Stockton is last in points and rebounds but second in assists and steals.  His profile looks like a defensive point guard.

Whereas Kareem Abdul-Jabbar is 3rd in rebounds and 3rd in blocks and 6th in scoring.  His profile looks like scoring Center.

I also wanted to be able to see the actual statistics, so I created a drill-down when clicking on any of the squares.  If you click on one of the points per game ranks, you have the option to drill down to the detailed stats view.

The Decline of the 1,000 Yard-Rusher

How To: FiveThirtyEight Electoral College Cartograms in Tableau

A lot of my previous work has been centered around custom maps or mapping techniques within Tableau.  I've always been fascinated with FiveThirtyEight's custom Electoral College cartogram used in their 2016 election forecast.  This type of cartogram was created in response to critiques about the use of geographic maps to show election data.

So here's how I did it in Tableau.  I happened to see a post that shows several different cartograms that are currently being used for the election.  In this post, you will see that the SVG for the different cartograms is there.  I took the SVG, converted it to a shapefile, and used the Alteryx Gallery tool to convert it to a CSV.  I did some manual matching to get the state abbreviations paired with the polygons as well.

Once I had the CSV, I was able to build it in Tableau.  Here's how it's done.

1. Download the file for the polygons

2. Open Tableau and connect to the data source.  In this case, I am joining another data set so that I can color the states by the candidates' chances of winning each state.  You will need to make sure your data set has a state abbreviation to join the polygon file to your data set.

3. Drag X to Columns and Y to Rows making sure the aggregation is AVG. Choose Polygon as the mark type and drag Polygon ID to Detail and Point ID to Path.

4. Drag Y to the Rows again making sure the aggregation is AVG.  Create a dual axis, synchronize the axes, and change the mark type to Text.  Drag the State Abbreviation to the Text mark card.

5. Drag the measure you'd like to color by to the Color mark.  Turn on the color borders.

6. Hide the headers, remove gridlines

Feel free to download the workbook and comment with questions.  I'm really excited to see how people use this for Tableau's election coverage.

How To: Add Vertical Lines to Slope Graphs With Multiple Measures

Andy Kriebel recently posted a great tutorial on adding vertical lines to a slope graph using reference lines.  This works great for slope graphs where you are comparing the same measure across dimensions, but what if you want to compare two measures across a dimension?

Using the Superstore data set, let's say we wanted to look at the percentage of Sales compared to the percentage of Profit across Categories.  First let's build our slope chart.

1. Drag the Sales pill to Rows and Category to the color.

2. Drag the Profit pill to the left side of the stacked bar so that you see the side by side bars.

3. Change the mark to line and create a percent of total table calculation on both measures.

4. Drag Measure Values to the label, format the percentages, and order the Measure Value pills so that Sales is on top.

Now we can see how Percent of Sales relates to Percent of Profit by category.  Now we want to be able to add those nice vertical lines to add structure and alignment to the visualization.

Since we are using different measures, we won't be able to use the calculations Andy used to create reference lines.  However, we can create reference lines using bar charts.

5. Create a calculated field with the value of 1.

6. Drag the calculated field to the Rows.  Move Measure Values to the detail and turn off the labels. Remove Category from the Color.

7. Create a dual axis.

8. Change the mark to a Bar, reduce the transparency, change the color, and turn off borders.

9. Reduce the size of the bars.

10. Edit the axis of the calculated field and set it to a fixed axis where the number is low enough for the vertical lines to extend to the top of the view.  Also, edit the axis of the Measure Values so that it is fixed from 0 to 1.

11. Switch the position of the pills on the rows shelf so that the vertical lines move to the back.  Hide the headers and clean up the chart.

That's it!  Now you have a slope graph comparing two measures with vertical lines.

Feel free to download the workbook and comment with any questions.