# add a way to label some of the yearslabel_years <-c(2010, 2015, 2021, 2025)label_data <- sched_diverse_long |> dplyr::filter(type %in%c("conf_pct", "nc_pct"), season %in% label_years) |> dplyr::mutate(label = scales::percent(pct, accuracy =0.1))sched_plot_one <- sched_diverse_long |> dplyr::filter(type %in%c("conf_pct", "nc_pct")) |> ggplot2::ggplot(ggplot2::aes(x = season, y = pct)) + ggchicklet::geom_chicklet(ggplot2::aes(fill = type)) + ggplot2::scale_fill_manual(values =c("conf_pct"="#e4572e", "nc_pct"="#6a7fd1")) + ggplot2::scale_y_continuous(labels = scales::percent_format(),limits =c(0, 1.05),breaks =c(0, 0.25, 0.50, 0.75,1.00)) + ggplot2::geom_text(data = label_data, ggplot2::aes(label = label),position = ggplot2::position_stack(vjust =0.5),color ="white",fontface ="bold",family ="mono",size =2.75 ) + ggplot2::labs(title ="<img src='https://a.espncdn.com/combiner/i?img=/redesign/assets/img/icons/ESPN-icon-basketball.png' width='15'/> Games in-and-out of conference <img src='https://a.espncdn.com/combiner/i?img=/redesign/assets/img/icons/ESPN-icon-basketball.png' width='15'/>",subtitle ="Percentage of regular season Division-I games played in <span style='color:#e4572e;'><b>conference</b></span> play and <span style='color:#6a7fd1;'><b>non-conference</b></span> since the 2010 season.<br>",caption ="Several teams have changed conferences during this time span. This past season, both the ACC and Big Ten played 20 regular season conference games. On average, D-I teams play around 31 regular season games each season.<br> <br> **Data via cbbdata and barttorkvik.com, theme from {flexoki} package <br>Viz by Chris at Bless your Chart**",x ="",y ="" ) + flexoki::theme_flexoki_light() + ggplot2::theme(legend.position ="none",plot.title = ggtext::element_markdown(hjust =0.5, size =16),plot.subtitle = ggtext::element_textbox_simple(color ="#222222", margin = ggplot2:::margin(t =5)),plot.caption = ggtext::element_textbox_simple(color ="#222222", margin = ggplot2:::margin(t =5)), ) + ggplot2::annotate(geom ="label",x =2021,y =1.025,color ="#333333",fill ="#e4572e",label ="COVID",size =3,fontface ='bold',family ='mono',alpha =0.3 )ggplot2::ggsave("splot1.png", sched_plot_one,w =8.5,h =8.5,dpi =600,bg ="white",type ='cairo')sched_plot_one
Code
# when the conference plays its games# add textjan_label_years <-c(2010, 2015, 2025)jan_label_data <- sched_diverse_long |> dplyr::filter(!type %in%c("conf_pct", "nc_pct")) |> dplyr::mutate(type =factor( type,levels =c("nc_before_jan1_pct","conf_before_jan1_pct","nc_after_jan1_pct","conf_after_jan1_pct" ) )) |> dplyr::arrange(season, type) |> dplyr::group_by(season) |> dplyr::mutate(ypos =cumsum(pct) -0.5* pct) |> dplyr::ungroup() |> dplyr::filter(season %in% jan_label_years) |> dplyr::filter(pct >=0.03) |> dplyr::mutate(label = scales::percent(pct, accuracy =0.1))sched_plot_two <- sched_diverse_long |> dplyr::filter(!type %in%c("conf_pct", "nc_pct")) |> dplyr::mutate(type =factor( type,levels =c("nc_before_jan1_pct","conf_before_jan1_pct","nc_after_jan1_pct","conf_after_jan1_pct" ) )) |> ggplot2::ggplot(ggplot2::aes(x = season, y = pct)) + ggchicklet::geom_chicklet(ggplot2::aes(fill = type)) + ggplot2::scale_y_continuous(labels = scales::percent_format(),limits =c(0, 1.05),breaks =c(0, 0.25, 0.50, 0.75,1.00)) + ggplot2::geom_text(data = jan_label_data, ggplot2::aes(x = season, y = ypos, label = label),color ="white",fontface ="bold",family ="mono",size =2.5 ) + ggplot2::scale_fill_manual(values =c("nc_before_jan1_pct"="#e0aaff","conf_before_jan1_pct"="#95d5b2","nc_after_jan1_pct"="#5a189a","conf_after_jan1_pct"="#2d6a4f" ) ) + ggplot2::labs(title ="<img src='https://a.espncdn.com/combiner/i?img=/redesign/assets/img/icons/ESPN-icon-basketball.png' width='15'/> When are games played? <img src='https://a.espncdn.com/combiner/i?img=/redesign/assets/img/icons/ESPN-icon-basketball.png' width='15'/>",subtitle ="Percentage of regular season Division-I games played in conference and non-conference played:<br> <b>before Jan. 1:</b> <span style='color:#e0aaff;'><b>non-conference</b></span> | <span style='color:#95d5b2;'><b>conference</b></span><br> <b>after Jan. 1:</b> <span style='color:#5a189a;'><b>non-conference</b></span> | <span style='color:#2d6a4f;'><b>conference</b></span><br> ",caption ="During the 2009-10 season, 536 non-conference regular games were played <em>after January 1</em>. This past season (2024-25), just 28 regular season non-conference games were played <em>after January 1</em>.<br> <br> **Data via cbbdata and barttorkvik.com, theme from {flexoki} package <br>Viz by Chris at Bless your Chart**",x ="",y ="" ) + flexoki::theme_flexoki_light() + ggplot2::theme(legend.position ="none",plot.title = ggtext::element_markdown(hjust =0.5, size =16),plot.subtitle = ggtext::element_textbox_simple(color ="#222222", margin = ggplot2:::margin(t =5)),plot.caption = ggtext::element_textbox_simple(color ="#222222", margin = ggplot2:::margin(t =5)), ) + ggplot2::annotate(geom ="label",x =2021,y =1.025,color ="#333333",fill ="#2d6a4f",label ="COVID",size =3,fontface ='bold',family ='mono',alpha =0.3 )ggplot2::ggsave("splot2.png", sched_plot_two,w =8.5,h =8.5,dpi =600,bg ="white",type ='cairo')sched_plot_two
# --- function for team headers md =function(x) { gt::html(x )}team_headers <-c("Florida St.", "NC State", "Georgia Tech", "North Carolina", "Miami (FL)", "Clemson", "Duke", "Louisville", "Virginia", "Wake Forest", "Notre Dame", "Virginia Tech","Pittsburgh", "Boston College", "Stanford", "California")# cfbplotR urls from https://github.com/Kazink36/cfbplotR/blob/main/data-raw/logo_ref_2.csvteam_img_urls <-c("http://a.espncdn.com/i/teamlogos/ncaa/500/52.png", # fsu "http://a.espncdn.com/i/teamlogos/ncaa/500/152.png", #ncsu"http://a.espncdn.com/i/teamlogos/ncaa/500/59.png", # gt"http://a.espncdn.com/i/teamlogos/ncaa/500/153.png", # unc"http://a.espncdn.com/i/teamlogos/ncaa/500/2390.png", # miami"http://a.espncdn.com/i/teamlogos/ncaa/500/228.png", #clemson"http://a.espncdn.com/i/teamlogos/ncaa/500/150.png", # duke"http://a.espncdn.com/i/teamlogos/ncaa/500/97.png", # lville"http://a.espncdn.com/i/teamlogos/ncaa/500/258.png", # uva"http://a.espncdn.com/i/teamlogos/ncaa/500/154.png", # wake forest"http://a.espncdn.com/i/teamlogos/ncaa/500/87.png", # notre dame"http://a.espncdn.com/i/teamlogos/ncaa/500/259.png", # vt"http://a.espncdn.com/i/teamlogos/ncaa/500/221.png", #pitt"http://a.espncdn.com/i/teamlogos/ncaa/500/103.png", # bc"http://a.espncdn.com/i/teamlogos/ncaa/500/24.png", # stanford"http://a.espncdn.com/i/teamlogos/ncaa/500/25.png"# cal)add_team_header <-function(team_name, img_url) { gtExtras::img_header(label ="",img_url = img_url,height =25,palette =c("white") )}# add teams headersteam_headers_with_images <- purrr::map2(team_headers, team_img_urls, add_team_header) |> purrr::set_names(team_headers)# table header baseball_header <-glue::glue("<div style='display: flex; justify-content: space-between; align-items: center;'> <div> <img src='https://a3.espncdn.com/combiner/i?img=%2Fredesign%2Fassets%2Fimg%2Ficons%2FESPN%2Dicon%2Dbaseball.png' style='height: 40px; width: auto; vertical-align: middle;'> </div> <div style='flex-grow:1; margin-left: 30px; margin-right: 30px'> <span style='display: block; font-weight: bold; text-align: center; font-size: 24px;'>ACC Baseball Record Matrix</span> <span style='font-size: 14px; font-weight: normal; display: block; text-align: center;'>Conference records through May 4 games.</span> </div> <div> <img src='https://a.espncdn.com/combiner/i?img=/i/teamlogos/ncaa_conf/500/1.png' style='height: 60px; width: auto; vertical-align: middle;'> </div> </div> <br>")long_tbl |> dplyr::mutate(dplyr::across(-c(team, record_diff),~ifelse(is.na(.x), "-", as.character(.x)))) |> gt::gt() |> gt::cols_label(team ="", !!!team_headers_with_images) |> gt::cols_align('center') |> gt::fmt_markdown('team') |> gtUtils::gt_theme_gtutils() |> gtExtras::gt_merge_stack(col1 ="team",col2 ="record_diff",palette =c("black", "black"),small_cap =FALSE ) |> gt::data_color(columns =c(-team, -record_diff),fn = scales::col_factor(palette =c("#FFFDF5", "#ffe0e0", "#ff9999", "#ffcccc", "#b2ffb2", "#7FFF7F", "#00FF00"),domain =c("-", "0-3", "0-2", "1-2", "2-0", "2-1", "3-0") ) ) |> gt::tab_header(title = gt::html(baseball_header)) |> gt::tab_source_note(source_note = gt::html("<hr>Data via baseballR, stats.ncaa.org | theme via {gtUtils} <br> Read the data left to right to see each team's record against other league opponents, plus overall league record and run differential.<br> <hr><b>Table by Chris at Bless your chart | data from May 5, 2025</b>" ) ) |> gtUtils::gt_border_bars_bottom(c("#636363", "#969696", "#cccccc")) |> gt::tab_options(table.width = gt::px(675)) |> gt::tab_style(locations = gt::cells_source_notes(),style = gt::cell_text(font = gt::google_font("Signika Negative"),size = gt::px(11.5),weight =250 ) ) |> gtUtils::gt_border_grid(color ="black",weight =0.5,include_labels =FALSE) |> gt::tab_style(style =list( gt::cell_text(font = gt::google_font("Signika Negative"),size = gt::px(14) ) ),locations = gt::cells_body(rows = gt::everything(),columns = gt::everything() ) ) -> acc_tblgtUtils::gt_save_crop(acc_tbl,file ="acc_tbl.png",whitespace =30,bg ="#FFFDF5")acc_tbl
ACC Baseball Record MatrixConference records through May 4 games.
14-7 | +30
-
-
-
-
2-1
2-1
-
1-2
-
1-2
2-1
3-0
-
3-0
-
-
15-8 | +22
-
-
-
-
0-2
3-0
1-2
2-1
2-1
-
-
2-1
2-1
-
-
3-0
15-9 | +74
-
-
-
-
0-3
1-2
-
-
1-2
-
3-0
2-1
2-1
-
3-0
3-0
15-9 | +51
-
-
-
-
2-1
-
2-1
1-2
-
3-0
-
2-1
2-1
2-1
1-2
-
14-9 | +11
1-2
2-0
3-0
1-2
-
-
2-1
-
-
0-3
-
-
2-1
3-0
-
-
14-10 | -17
1-2
0-3
2-1
-
-
-
-
2-1
-
2-1
2-1
-
-
-
2-1
3-0
14-10 | +48
-
2-1
-
1-2
1-2
-
-
-
3-0
-
-
2-1
3-0
-
0-3
2-1
13-11 | +36
2-1
1-2
-
2-1
-
1-2
-
-
-
-
1-2
1-2
-
3-0
-
2-1
11-10 | +7
-
1-2
2-1
-
-
-
0-3
-
-
-
-
-
2-1
1-2
3-0
2-1
12-12 | +23
2-1
-
-
0-3
3-0
1-2
-
-
-
-
3-0
0-3
-
1-2
2-1
-
12-15 | -13
1-2
-
0-3
-
-
1-2
-
2-1
-
0-3
-
1-2
-
1-2
3-0
3-0
11-16 | -16
0-3
1-2
1-2
1-2
-
-
1-2
2-1
-
3-0
2-1
-
0-3
-
-
-
9-15 | -77
-
1-2
1-2
1-2
1-2
-
0-3
-
1-2
-
-
3-0
-
1-2
-
-
10-17 | -70
0-3
-
-
1-2
0-3
-
-
0-3
2-1
2-1
2-1
-
2-1
-
1-2
-
9-18 | -69
-
-
0-3
2-1
-
1-2
3-0
-
0-3
1-2
0-3
-
-
2-1
-
0-3
6-18 | -40
-
0-3
0-3
-
-
0-3
1-2
1-2
1-2
-
0-3
-
-
-
3-0
-
Data via baseballR, stats.ncaa.org | theme via {gtUtils}
Read the data left to right to see each team's record against other league opponents, plus overall league record and run differential. Table by Chris at Bless your chart | data from May 5, 2025