Building a Shot-Plotting App in Shiny

For me at least, hand tracking is 99% of the time born out of necessity. 

The only way I am ever going to get location data for shots is if I break out a multicoloured pen and write down all the locations and numbers myself. Its isn’t however exactly the quickest process to deal with.

I actually really enjoy hand tracking is the thing, It keeps me focused on the game at hand and stops my mind from wandering. The issue comes when it’s time to digitise that information for analysis. I have written about this before over at The Ice Garden, back when I tracked an entire season of the Australian Womens Hockey League. That season it took me around an hour of straight work to plug in every piece of information so that tableau could process it and as my life got busier, the amount of free time I could dedicate got less and less. 

The idea to force a shiny app to do something it has no right to do came out of necessity. Partially because I wanted to be able to show heat maps to the Head Coach of the local team I work with during intermission, but mostly because my Masters project consists of getting school kids ages 11+ involved in sports analytics and I really wanted them to be able to produce their own heat maps and yet I really did not want to attempt to explain the complexities of Kernel Density Charts to a collection of 12-year-olds.

So here we are. 

The Hockey Plotter 1.1

The applications works based on a combination of the reactiveValues and observeEvent objects with everything feeding into the other. The main aspect of the app is the interactive rink which allows you to plot shot locations based on player, team, and event type (a simple single click for a shot, and a double click for a goal). With each input the app stitches another row onto the bottom of the existing values data table from which everything is run. 

Input shots by Player # and Team
Input shots by Player # and Team
Download PbP data for storage + further analysis
Add Headings and customise density map by team, and event type

In terms of further work theres lots I still want to add. A player filter that can be toggled on or off is the big one that I’m currently working on. As well as a way users to upload their own data and customise the team names.

Regardless of how far it still perhaps has to go, I think it’s neat. 

And I really truly hope that in some way it can help lower the entry barrier to shot tracking and allow more teams in fringe leagues to get access to this type of data

The code and a more in depth description of how it works can be found on my Github.

2 thoughts on “Building a Shot-Plotting App in Shiny

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s