mirror of
https://github.com/msberends/AMR.git
synced 2026-11-16 04:20:53 +01:00
(v3.1.0.9018) Italicise taxonomic names in all plotting functions using labels_taxonomy(), and fix ggplot_pca() with explicit groups
This commit is contained in:
1 parent
cfb55a4c3e
commit
77b6cb1713
10 files changed
+78
-11
No files matched your search
@@ -73,4 +73,12 @@ test_that("test-italicise_taxonomy.R", {
|
||||
expression(italic("E. coli"), "Other")
|
||||
)
|
||||
expect_identical(labels_taxonomy(character(0)), expression())
|
||||
|
||||
# used internally by the plotting functions
|
||||
expect_true(AMR:::contains_taxonomy(c("E. coli", "Other", NA)))
|
||||
expect_false(AMR:::contains_taxonomy(c("Other", "CoNS", NA)))
|
||||
expect_identical(
|
||||
AMR:::labeller_taxonomy(list(mo = c("E. coli", "CoNS"))),
|
||||
list(mo = list(expression(italic("E. coli")), expression("CoNS")))
|
||||
)
|
||||
})
|
||||
@@ -60,6 +60,13 @@ test_that("test-pca.R", {
|
||||
if (AMR:::pkg_is_available("ggplot2")) {
|
||||
ggplot_pca(pca_model, ellipse = TRUE)
|
||||
ggplot_pca(pca_model, arrows_textangled = FALSE)
|
||||
# explicit groups, with and without labels
|
||||
my_groups <- c("Gram-positive", "Gram-negative", "Gram-negative")
|
||||
p <- ggplot_pca(pca_model, groups = my_groups)
|
||||
expect_identical(p$data$groups, my_groups)
|
||||
expect_identical(p$labels$colour, "my_groups")
|
||||
p <- ggplot_pca(pca_model, labels = resistance_data$genus, groups = my_groups)
|
||||
expect_identical(p$data$groups, my_groups)
|
||||
}
|
||||
|
||||
if (AMR:::pkg_is_available("dplyr", min_version = "1.0.0", also_load = TRUE)) {
|
||||
|
||||
Reference in new issue
Block a user