From 0400f0065a9e7206af7fd0cc8b2de9b9cc1290d3 Mon Sep 17 00:00:00 2001 From: mrcaseb Date: Wed, 5 Mar 2025 21:42:58 +0100 Subject: [PATCH 1/2] gt alt texts --- DESCRIPTION | 2 +- NEWS.md | 1 + R/gt_nfl.R | 20 ++++++++++++++++++-- nflplotR.Rproj | 1 + 4 files changed, 21 insertions(+), 3 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index cf3cd5ff..ff01c389 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: nflplotR Title: NFL Logo Plots in 'ggplot2' and 'gt' -Version: 1.4.0.9001 +Version: 1.4.0.9002 Authors@R: person("Sebastian", "Carl", , "mrcaseb@gmail.com", role = c("aut", "cre")) Description: A set of functions to visualize National Football League diff --git a/NEWS.md b/NEWS.md index 5357713d..136b6bac 100644 --- a/NEWS.md +++ b/NEWS.md @@ -3,6 +3,7 @@ * Updated the New York Jets logo (again) to their new secondary logo introduced in the 2024 off-season. This aligns with the logo used across nfl dot com and it has been voted for in a poll. (#68) * The theme elements `element_nfl_logo()` and `element_nfl_wordmark()` now clean team abbreviations by calling `nflreadr::clean_team_abbrs()` and insert empty grobs for mismatches. * All geoms and theme elements will print more informative warnings about team abbreviation, or player ID mismatches. +* The gt logo rendering functions now add alt text for accessibility and to silence an annoying pkgdown warning. # nflplotR 1.4.0 diff --git a/R/gt_nfl.R b/R/gt_nfl.R index 077dd391..d010e872 100644 --- a/R/gt_nfl.R +++ b/R/gt_nfl.R @@ -140,7 +140,15 @@ gt_nfl_cols_label <- function(gt_object, # Create the image URI uri <- get_image_uri(team_abbr = team_abbr, type = type) # Generate the Base64-encoded image and place it within tags - out <- paste0("") + out <- paste0( + "\"The" + ) # If the image uri returns NA we didn't find a match. We will return the # actual value then to avoid removing a label out[is.na(uri)] <- x[is.na(uri)] @@ -176,7 +184,15 @@ gt_nflplotR_image <- function(gt_object, # Create the image URI uri <- get_image_uri(team_abbr = team_abbr, type = type) # Generate the Base64-encoded image and place it within tags - out <- paste0("") + out <- paste0( + "\"The" + ) out <- lapply(out, gt::html) # If the image uri returns NA we didn't find a match. We will return the # actual value then to allow the user to call gt::sub_missing() diff --git a/nflplotR.Rproj b/nflplotR.Rproj index 69fafd4b..630d7e3d 100644 --- a/nflplotR.Rproj +++ b/nflplotR.Rproj @@ -1,4 +1,5 @@ Version: 1.0 +ProjectId: 4cc57ef7-8811-41ca-a4f1-12c67158ba76 RestoreWorkspace: No SaveWorkspace: No From 242f1c6394b7e3c549535413d45283613d8b2ab2 Mon Sep 17 00:00:00 2001 From: mrcaseb Date: Wed, 5 Mar 2025 21:44:07 +0100 Subject: [PATCH 2/2] update news bullet --- NEWS.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NEWS.md b/NEWS.md index 136b6bac..70d6e18f 100644 --- a/NEWS.md +++ b/NEWS.md @@ -3,7 +3,7 @@ * Updated the New York Jets logo (again) to their new secondary logo introduced in the 2024 off-season. This aligns with the logo used across nfl dot com and it has been voted for in a poll. (#68) * The theme elements `element_nfl_logo()` and `element_nfl_wordmark()` now clean team abbreviations by calling `nflreadr::clean_team_abbrs()` and insert empty grobs for mismatches. * All geoms and theme elements will print more informative warnings about team abbreviation, or player ID mismatches. -* The gt logo rendering functions now add alt text for accessibility and to silence an annoying pkgdown warning. +* The gt logo rendering functions now add alt text for accessibility and to silence an annoying pkgdown warning. (#69) # nflplotR 1.4.0