duelingdata.blogspot

  • Subscribe to our RSS feed.
  • Twitter
  • StumbleUpon
  • Reddit
  • Facebook
  • Digg

Saturday, 1 April 2017

NFL Combine & Triangle/Ternary Plot

Posted on April 01, 2017 by kabir
Triangle/Ternary plots are a good way of displaying the relative positioning of points across three variables. This can be used to cluster and classify points based on these three variables. After the break I have outlined a way of creating an interactive version of a triangle/ternary plot in Tableau.

Here is an example of a triangle/ternary plot on the performance of collegiate players at the 2017 NFL combine across three variables: size (BMI), speed (40 time) and strength (bench press).


hot to make it using R & Tableau
To create this using R and Tableau is relatively easy. First, you need a file with just three variables scaled appropriately. For example, in the above chart, a high 40 time is not good or representative of high speed. So I normalized all of the variables using min-max normalization:
You can do this is in R, Alteryx, Excel or whatever. Then inverted the value for 40 times:
So I have a table of 3 normalized variables (40 time, BMI, and bench press) by player. I also add 3 anchor points to determine the corners of my triangle plot. So I have three extra rows where the value is 0 for each row except 1 for each variable.

I then save this as a csv file. I import these variables into R in order to create the triangle/ternary plot. Here is the R script below:

install.packages("ade4")
library(ade4)
tri_data <- read.csv('C:\\Users\\name\\Documents\\2017_Combine4.csv')
x <-triangle.plot(tri_data, label = as.character(1:nrow(ta)))
write.csv(x, 'C:\\Users\\name\\Documents\\2017_Combine_Tri_w_anchors.csv')


This will create X and Y coordinates associated with each point (player). I append this to my player data set and bring this into Tableau. To create the triangle plot in Tableau I place the X coordinates in the column shelf and the Y coordinates in the row shelf and convert the measures to continuous dimensions.


Finally, I add a triangle as a background image, fix the X and Y axes, and then remove anchor points (in the corners). I also do some formatting removing the gridlines, adding color, and increasing the transparency.



hot to make using it just Tableau
The talented Mike Cisneros (@mikevizneros) recommended an approach that skipped the R step and allows you to create this entirely in Tableau. Here is link to Mke's version on Tableau Public. It only requires two simple calcs and is much more clever than mine.

Essentially, Mike imported the same data, normalized in Tableau, and then created the X and Y coordinates in Tableau rather than R. In the below Benchn, Bmin and 40n are the normalized measure values for Strength/Bench, Size/BMI, and Speed/40 Time respectively. Here are Mike's calcs in Tableau:




See details on these calculations here on Wikipedia. You again place the X and Y values into the column and row shelves respectively and repeat the other steps above.

You can download my Tableau Public file above. It has both versions (R and Tableau) included. I hope this is helpful. If you have questions please leave them in the comments box below. Thank you.


Email ThisBlogThis!Share to XShare to Facebook
Posted in | No comments
Newer Post Older Post Home

0 comments:

Post a Comment

Subscribe to: Post Comments (Atom)

Popular Posts

  • How To Gauge Chart in Tableau (UPDATED)
    A while back I wrote a post on how to create a gauge chart in Tableau . At the time I felt bad about writing it because I thought it was a b...
  • Spark Bar Chart
    A spark bar chart, at least that is what I am calling it for now, combines a sparkline and a bar chart into one chart. The length of the bar...
  • Art & Political Entrenchment
    I recently visited the Phillips Collection gallery here in DC and saw the work of one of my favorite artists: Camille Pissarro. In one of hi...

Blog Archive

  • September 2017 (1)
  • August 2017 (3)
  • July 2017 (2)
  • June 2017 (2)
  • April 2017 (2)
  • February 2017 (1)
  • January 2017 (1)
  • December 2016 (1)
  • November 2016 (2)
  • August 2016 (4)
Powered by Blogger.

Search This Blog

Report Abuse

  • Home

About Me

kabir
View my complete profile