Skip to content

Commit

Permalink
Merge pull request #39 from eliocamp/fix-ggnewscale
Browse files Browse the repository at this point in the history
Fix failing reverse dependency check for new version of ggnewscale
  • Loading branch information
LudvigOlsen authored Jul 20, 2024
2 parents 81970f7 + 8a3343b commit a8a32d2
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ Suggests:
e1071 (>= 1.7-2),
furrr,
ggimage (>= 0.3.3),
ggnewscale (>= 0.4.3),
ggnewscale (>= 0.5.0),
knitr,
merDeriv (>= 0.2-4),
nnet (>= 7.3-12),
Expand Down
18 changes: 12 additions & 6 deletions tests/testthat/test_plotting_functions.R
Original file line number Diff line number Diff line change
Expand Up @@ -309,10 +309,13 @@ test_that("plot_confusion_matrix() with sum tiles, class order, and intensity_by
c("NewGeomTile", "GeomTile", "GeomTile", "GeomImage", "GeomText", "GeomText",
"GeomText", "GeomText", "GeomText", "GeomText", "GeomText", "GeomText",
"GeomImage", "GeomImage", "GeomImage", "GeomImage"))

labels <- p1$labels
attributes(labels$fill_ggnewscale_1) <- NULL
expect_equal(
p1$labels,
list(x = "Target", y = "Prediction", fill_new = "Normalized",
label = "N", fill = "Intensity", image = "image_3d")
labels,
list(x = "Target", y = "Prediction", fill_ggnewscale_1 = "Normalized",
label = "N", fill = "Intensity", image = "image_3d"),
)

# It's the normalized data (percentages)
Expand All @@ -328,7 +331,7 @@ test_that("plot_confusion_matrix() with sum tiles, class order, and intensity_by

expect_equal(
p1$mapping,
structure(list(x = ~ .data$Target, y = ~ .data$Prediction, fill_new = ~ .data$Intensity),
structure(list(x = ~ .data$Target, y = ~ .data$Prediction, fill_ggnewscale_1 = ~ .data$Intensity),
class = "uneval"
)
)
Expand All @@ -350,11 +353,14 @@ test_that("plot_confusion_matrix() with sum tiles, class order, and intensity_by
"GeomText", "GeomImage", "GeomImage", "GeomImage", "GeomImage"
)
)

labels <- p2$labels
attributes(labels$fill_ggnewscale_1) <- NULL
expect_equal(
p2$labels,
labels,
list(
x = "Target", y = "Prediction",
fill_new = "Normalized",
fill_ggnewscale_1 = "Normalized",
label = "N",
fill = "Intensity",
image = "image_skewed_lines"
Expand Down

0 comments on commit a8a32d2

Please sign in to comment.