Shiny Contest Submission: National Hockey League Play-by-Play App

Unveiling the National Hockey League (NHL) Play-by-Play App!

The NHL PBP App is your #1 destination for interactively visualizing shot data for all games in the 2017-2018 NHL season. Using real-time scoring stats (RTSS) from Corsica Hockey, see all the shot locations on the official NHL ice rink embedded with your team logo, enjoy a gganimate animation of each shot, and even find out where your favorite player took all his shots.

This application was motivated by Ryo's blog post: Animating the Goals of the World Cup, BallR by Todd Schneider, and football animations by Michael Lopez on the NFL Big Data Bowl Repo

Technical Features:

  • gganimate rendered animation of all shots + animated line graph of all the probabilities that a shot becomes a goal throughout the game (please be patient as this takes a few seconds to load).
  • Using shinycssloaders package, I've added css animated loaders to all my plots.
  • Depending on game selection, I've embedded team logos on the official NHL ice rink in the animation and shot chart.
  • iframe generated webpage of Official Recap of each game
  • Using the rintrojs package, I've included a short tour of the application.

Link to
Link to RStudio Cloud Project:
Walkthrough of the App:
Github Repo:

1 minute Demo:



Feature Update

  1. Access to 10+ seasons of shot data & this season (2018-2019) updated daily at 11:00AM EST
  2. Interactive Shot Chart for in-depth info(shooter, type of shot, distance from goal, and expected goal probability) using plotly
  3. Took out adjustment for puck size feature


Throughout this update process, I learned to use crontab to schedule running R scripts, use reactives inside the server Shiny code to reactively load datasets, and embedding images in plotly graphs

Link to
Link to RStudio Cloud Project:


Feature Update

  • Player Density Plot: Density Plot of Shots and Goals where the redder the region, the higher the density of shots (goals)

Throughout this update process, I learned to use stat_density_2d and draw shapes inside ggplot2 with the help of ggforce

Link to
Link to RStudio Cloud Project:

Feature Update

With help of this StackOverflow answer, I’ve changed the #gganimate code and made the puck move smoother.


Always appreciate the support of the #rstats community.

Link to
Link to RStudio Cloud Project:

1 Like

Hi @jsonbaik

The NHL animation is really fascinating. Did you actually crawl the NBA API or does it allow enough requests such that you can do it live inside the app? This was one of the main problems in my app, as the STRAVA API I used is really restricted.


1 Like

Hello @zappingseb,

I actually didn't use the NHL API since I have the raw csv file on hand. So, I simply hosted all the data on Github and used a reactive function to call each season depending on the user's selection. For current season, I use crontab to automatically upload the dataset to the app.

Hope this helps and thanks for your interest

1 Like