Nicole A. Blews
2022-04-27
This presentation is going to provide a visualization of NHL Champions by year and compare their averages from that season to the league averages. Data for the visualization was sourced from https://www.hockey-reference.com.
NHL Teams Data
## # A tibble: 4 x 17
## Franchise Lg From To Yrs GP W L T OL PTS `PTS%`
## <chr> <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 Montreal C~ NHL 1917 2022 104 6865 3493 2349 837 186 8009 0.583
## 2 Toronto Ma~ NHL 1917 2022 104 6864 3051 2850 783 180 7065 0.515
## 3 Toronto St~ NHL 1919 1926 7 186 94 87 5 NA 193 0.519
## 4 Boston Bru~ NHL 1924 2022 97 6703 3288 2428 791 196 7563 0.564
## # ... with 5 more variables: `Yrs Plyf` <dbl>, Div <dbl>, Conf <dbl>,
## # Champ <dbl>, `St Cup` <dbl>
Stanley Cup by Year Data
## # A tibble: 4 x 32
## Year Season Lg Team AvAge GP W L T OL PTS `PTS%`
## <dbl> <chr> <chr> <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 2021 2020-21 NHL Tampa Ba~ 28.4 56 36 17 NA 3 75 0.67
## 2 2020 2019-20 NHL Tampa Ba~ 27.7 70 43 21 NA 6 92 0.657
## 3 2019 2018-19 NHL St. Loui~ 28 82 45 28 NA 9 99 0.604
## 4 2018 2017-18 NHL Washingt~ 28.4 82 49 26 NA 7 105 0.64
## # ... with 20 more variables: GF <dbl>, GA <dbl>, SRS <dbl>, SOS <dbl>,
## # `GF/G` <dbl>, `GA/G` <dbl>, PP <dbl>, PPO <dbl>, `PP%` <dbl>, PPA <dbl>,
## # PPOA <dbl>, `PK%` <dbl>, SH <dbl>, SHA <dbl>, SOG <dbl>, `S%` <dbl>,
## # SA <dbl>, `SV%` <dbl>, PDO <dbl>, SO <dbl>
League Averages by Year Data
## # A tibble: 4 x 14
## Rk Year Season Lg GP G PP PPO `PP%` `PK%` SA SV
## <dbl> <dbl> <chr> <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 2 2021 2020-21 NHL 868 2.94 0.57 2.89 19.8 80.2 29.8 27.1
## 2 3 2020 2019-20 NHL 1082 3.02 0.6 2.97 20.0 80.0 31.3 28.4
## 3 4 2019 2018-19 NHL 1271 3.01 0.58 2.92 19.8 80.2 31.3 28.5
## 4 5 2018 2017-18 NHL 1271 2.97 0.61 3.04 20.2 79.8 31.8 29
## # ... with 2 more variables: SVPerc <dbl>, GAA <dbl>
The data shows that most teams that won either had an overall higher score average per game compared to the league average OR they had a higher percentage of goals saved that year, with their goalie ultimately winning them the cup.
This graph demonstrates how many times a franchise made it to the playoffs and compares a percentage of how many of those playoffs they actually won.
Codes utilized for graphs
plot_ly(
data = Stanley1960, x= ~Year, y= ~`GF/G`, color = ~Team,
type = 'scatter', mode = 'markers') %>%
layout(
title = "<b>Yearly Winner by Average Goals Per Game, 1960-2021<b>",
xaxis = list(title = "<b>Year<b>"),
yaxis = list(title = "<b>Avg Goals Per Game<b>"),
plot_bgcolor = "#e5ecf6") %>% add_trace(x=LeageAvgs$Year, y=LeageAvgs$G, type="scatter", mode="lines", name = 'NHL Avg GPG', inherit = FALSE)
plot_ly(
data = StanleyCupByYear, x= ~Year, y= ~`SV%`, color = ~Team,
type = 'scatter', mode = 'markers') %>%
layout(
title = "<b>Yearly Winner by Goal Save Percent, 1960-2021<b>",
xaxis = list(title = "<b>Year<b>"),
yaxis = list(title = "<b>Goal Save Percentage<b>"),
plot_bgcolor = "#e5ecf6") %>% add_trace(x=LeageAvgs$Year, y=LeageAvgs$SVPerc, type="scatter", mode="lines", name = 'NHL Avg GPG', inherit = FALSE)fig2 <- NHLTeams2 %>% filter(`St Cup` > 0)
fig2 <- fig2 %>%
mutate(PercentPlayWon = (`St Cup`/`Yrs Plyf`)*100)
plot_ly(
data = fig2, x= ~Franchise, y= ~`St Cup`, type = 'bar',
name = 'Count of Wins',
hovertemplate = ~paste("Franchise: ", Franchise, "<br>Stanley Cup Wins: ", `St Cup`)) %>%
layout(title = "<b>Number of Stanley Cup Wins, 1917-2022<b>",
xaxis = list(title = "<b>Franchise<b>"),
yaxis = list(title = "# of <b>Stanley Cup<b> Wins"),
plot_bgcolor = "#e5ecf6") %>%
add_trace(fig2, x = ~Franchise, y = ~`PercentPlayWon`, type = 'scatter',
mode = 'markers', yaxis="y2", name = "% of Playoffs",
text = ~`Yrs Plyf`,
hovertemplate = paste('%{x}', '<br>Playoffs Played: %{text:.2s}<br>')) %>%
layout(yaxis2 = list(overlaying = "y",
side = "right",
title = "<b>Percent</b> of Playoffs Won out of Played")) %>%
layout(legend = list(x = 100, y = -.20))