Background

This document is going to be plotting and comparing the expected score for AFL teams of the 2023 and 2022 seasons.

It is important to note that the datafile was publicly avaialbe meaning that there are missing games etc. Nonetheless, it still gives a good insight inot the differences from both years. Furthermore, the values of expected scores were extracted and inserted manually for this specific project. If you would like the dataset, please feel free to reach out

Libraries

2021 Code

team_sums <- data.frame(
  playing_for = c(
    "Adelaide Crows", "Brisbane Lions", "Carlton", "Collingwood", "Essendon",
    "Fremantle", "Geelong Cats", "Gold Coast Suns", "GWS Giants", "Hawthorn",
    "Melbourne", "North Melbourne", "Port Adelaide", "Richmond", "St Kilda",
    "Sydney Swans", "West Coast Eagles", "Western Bulldogs"
  ),
  S_Result = c( 
    #This is the actual scores for the 2021 season
    1059, 1447, 1099, 1045, 1263, 998, 1193, 918, 1146, 1096, 1208, 974, 1310,
    1160, 1125, 1405, 1058, 1233
  ),
  X_Result = c( 
    #This is the expected scores
    1069.1335, 1376.1259, 1131.3704, 1041.7101, 1224.7414, 1050.6583, 1129.2150,
    986.1562, 1147.1566, 1060.8908, 1268.1115, 967.2222, 1231.5561, 1141.3245,
    1066.5440, 1206.5963, 991.4445, 1270.3204
  ),
  image_url = c(
    # image URLs corresponding to each team
    # You can replace these with updated logos
    "https://logos-download.com/wp-content/uploads/2017/05/Adelaide_Crows_logo_logotype_emblem-700x464-420x278.png",
    "https://logos-download.com/wp-content/uploads/2017/05/Brisbane_Lions_logo-608x700-420x484.png",
    "https://logos-download.com/wp-content/uploads/2017/05/Carlton_Blues_logo-674x700-420x436.png",
    "https://logos-download.com/wp-content/uploads/2017/05/Collingwood_Magpies_logo-567x700-420x519.png",
    "https://logos-download.com/wp-content/uploads/2017/05/Essendon_Bombers_logo-700x574-420x344.png",
    "https://logos-download.com/wp-content/uploads/2016/05/Fremantle_Dockers_logo.png",
    "https://logos-download.com/wp-content/uploads/2017/05/Geelong_Cats_logo-643x700-420x457.png",
    "https://logos-download.com/wp-content/uploads/2017/05/Gold_Coast_Suns_logo-700x571-420x343.png",
    "https://logos-download.com/wp-content/uploads/2017/05/GWS_Giants_logo_Greater_Western-Sydney_Giants-700x620-420x372.png",
    "https://logos-download.com/wp-content/uploads/2017/05/Hawthorn_Hawks_logo-700x643-420x386.png",
    "https://logos-download.com/wp-content/uploads/2017/05/Melbourne_Demons_logo_logotype-650x700-420x452.png",
    "https://logos-download.com/wp-content/uploads/2017/05/North_Melbourne_Kangaroos_logo_NMFC-554x700-420x531.png",
    "https://logos-download.com/wp-content/uploads/2017/05/Port_Adelaide_Power_logo_black-700x583-420x350.png",
    "https://logos-download.com/wp-content/uploads/2017/05/Richmond_Tigers_logo_transparent_bg-605x700-420x486.png",
    "https://logos-download.com/wp-content/uploads/2016/05/St_Kilda_Saints_logo.png",
    "https://logos-download.com/wp-content/uploads/2017/05/Sydney_Swans_logo_logotype-581x700-420x506.png",
    "https://logos-download.com/wp-content/uploads/2017/05/West_Coast_Eagles_logo_logotype-700x302-420x181.png",
    "https://logos-download.com/wp-content/uploads/2017/05/Western_Bulldogs_logo_logotype-597x700-420x492.png"
  )
)

Plotting The Values

ggplot(team_sums, aes(x = S_Result, y = X_Result)) +
  geom_image(aes(image = image_url), size = 0.05) +
  ggtitle(label = "Expected Score vs Total Score",
          subtitle = "Dataset does not include all games of 2021 season") +
  theme_minimal()

## 2022 Code Now to compare the 2022 Data, the previous process is repeated

team_sums2 <- data.frame(
  playing_for = c(
    "Adelaide Crows", "Brisbane Lions", "Carlton", "Collingwood", "Essendon",
    "Fremantle", "Geelong Cats", "Gold Coast Suns", "GWS Giants", "Hawthorn",
    "Melbourne", "North Melbourne", "Port Adelaide", "Richmond", "St Kilda",
    "Sydney Swans", "West Coast Eagles", "Western Bulldogs"
  ),
  S_Result = c(
    1447, 1405, 1310, 1263, 1233, 1208, 1193, 1160, 1146, 1125,
    1099, 1096, 1059, 1058, 1045, 998, 974, 918
  ),
  X_Result = c(
    1376.1259, 1206.5963, 1231.5561, 1224.7414, 1270.3204, 1268.1115,
    1129.2150, 1141.3245, 1147.1566, 1066.5440, 1131.3704, 1060.8908,
    1069.1335, 991.4445, 1041.7101, 1050.6583, 967.2222, 986.1562
  ),
  image_url = c(
    # Add your image URLs corresponding to each team
    # You can replace these with actual image URLs
    "https://logos-download.com/wp-content/uploads/2017/05/Adelaide_Crows_logo_logotype_emblem-700x464-420x278.png",
    "https://logos-download.com/wp-content/uploads/2017/05/Brisbane_Lions_logo-608x700-420x484.png",
    "https://logos-download.com/wp-content/uploads/2017/05/Carlton_Blues_logo-674x700-420x436.png",
    "https://logos-download.com/wp-content/uploads/2017/05/Collingwood_Magpies_logo-567x700-420x519.png",
    "https://logos-download.com/wp-content/uploads/2017/05/Essendon_Bombers_logo-700x574-420x344.png",
    "https://logos-download.com/wp-content/uploads/2016/05/Fremantle_Dockers_logo.png",
    "https://logos-download.com/wp-content/uploads/2017/05/Geelong_Cats_logo-643x700-420x457.png",
    "https://logos-download.com/wp-content/uploads/2017/05/Gold_Coast_Suns_logo-700x571-420x343.png",
    "https://logos-download.com/wp-content/uploads/2017/05/GWS_Giants_logo_Greater_Western-Sydney_Giants-700x620-420x372.png",
    "https://logos-download.com/wp-content/uploads/2017/05/Hawthorn_Hawks_logo-700x643-420x386.png",
    "https://logos-download.com/wp-content/uploads/2017/05/Melbourne_Demons_logo_logotype-650x700-420x452.png",
    "https://logos-download.com/wp-content/uploads/2017/05/North_Melbourne_Kangaroos_logo_NMFC-554x700-420x531.png",
    "https://logos-download.com/wp-content/uploads/2017/05/Port_Adelaide_Power_logo_black-700x583-420x350.png",
    "https://logos-download.com/wp-content/uploads/2017/05/Richmond_Tigers_logo_transparent_bg-605x700-420x486.png",
    "https://logos-download.com/wp-content/uploads/2016/05/St_Kilda_Saints_logo.png",
    "https://logos-download.com/wp-content/uploads/2017/05/Sydney_Swans_logo_logotype-581x700-420x506.png",
    "https://logos-download.com/wp-content/uploads/2017/05/West_Coast_Eagles_logo_logotype-700x302-420x181.png",
    "https://logos-download.com/wp-content/uploads/2017/05/Western_Bulldogs_logo_logotype-597x700-420x492.png"
  )
)

Plotting 2022

ggplot(team_sums2, aes(x = S_Result, y = X_Result)) +
  geom_image(aes(image = image_url), size = 0.05) +
  ggtitle(label = "Expected Score vs Total Score",
          subtitle = "Dataset does not include all games of 2022 season") +
  theme_minimal()

Conclusions

we can see through the 2 plots which were the teams that became better in 2022. A good example is collingwood who finished 17th and were quite low in both score metrics, and then compare this to 2022 when they made the Preliminary final and climbed significantly higher in both metrics.