(v3.0.1.9152) Let a named colours_SIR without S, I or R use the default colours for these, which fixes the example of ggplot_sir() with colours = c(SI = "yellow"), let ggplot_sir() pass the facet as a value to facet_sir(), and make the test of the eucast_I default independent of the AMR_guideline option

This commit is contained in:
dr. M.S. (Matthijs) Berends committed 2026-10-16 04:34:52 +02:00
1 parent 43accd35d1
commit 08aa47842e
7 files changed
+23 -11

No files matched your search

+6 -1
View File
@@ -120,6 +120,8 @@ test_that("test-plotting.R", {
expect_identical(AMR:::expand_SIR_colours(c(S = "s", I = "i", R = "r")), c("s", "s", "i", "r", "s", "r"))
expect_identical(AMR:::expand_SIR_colours(c("s", "i", "r")), c("s", "s", "i", "r", "s", "r"))
expect_error(AMR:::expand_SIR_colours(c(S = "s", I = "i", X = "r")))
# missing names S, I and R get the default colours, as in the example of ggplot_sir()
expect_identical(AMR:::expand_SIR_colours(c(SI = "y")), c("#3CAEA3", "#3CAEA3", "#F6D55C", "#ED553B", "y", "#ED553B"))
# colours of SIR bar plots follow the SIR values
sir_values <- as.sir(c("S", "S", "R", "NI", "NS"))
@@ -153,8 +155,11 @@ test_that("test-plotting.R", {
expect_identical(facet_sir(antibiotic)$params$facets, facet_sir("antibiotic")$params$facets)
# the default of eucast_I follows the guideline option
old_option <- options(AMR_guideline = "EUCAST")
expect_identical(scale_fill_sir(language = "en")$labels("I"), "(I) Susceptible, incr. exp.")
old_option <- options(AMR_guideline = "EUCAST 2018")
options(AMR_guideline = "EUCAST 2018")
expect_identical(scale_fill_sir(language = "en")$labels("I"), "(I) Intermediate")
options(AMR_guideline = "CLSI")
expect_identical(scale_fill_sir(language = "en")$labels("I"), "(I) Intermediate")
options(old_option)