yardstick
yardstick copied to clipboard
Add alt text to `autoplot` methods
To improve accessibility, we can add alt
labels to the output of the autoplot
methods.
Here is a very rough idea of a possibility:
library(tidymodels)
#> Registered S3 method overwritten by 'tune':
#> method from
#> required_pkgs.model_spec parsnip
data("hpc_cv")
# The confusion matrix from a single assessment set (i.e. fold)
cm <- hpc_cv %>%
filter(Resample == "Fold01") %>%
conf_mat(obs, pred)
autoplot(cm, type = "mosaic") +
labs(alt = paste0(
"A mosaic confusion matrix for classes VF, F, M, and L. ",
"The largest cell is VF/VF."
))
Created on 2021-05-19 by the reprex package (v2.0.0)
We can do more learning about how to write alt text for this context.