From 034deef1ec7268fd31a74f7afd8ef4bfe1b024f7 Mon Sep 17 00:00:00 2001 From: Anthony North Date: Fri, 2 Feb 2024 07:52:41 +0000 Subject: [PATCH] fixes #108 --- NEWS.md | 1 + R/scales.R | 1 - tests/testthat/test-scale.R | 14 ++++++++++++++ 3 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 tests/testthat/test-scale.R diff --git a/NEWS.md b/NEWS.md index f5a3d4d5..af99f6e3 100644 --- a/NEWS.md +++ b/NEWS.md @@ -6,6 +6,7 @@ - All layers now support geometry vectors which {wk} can read (#104) - Feature editor accepts geometry vectors which {wk} can read (#105) - Use {yyjsonr} for faster serialisation (#110) +- Fix quantile scales (#108) # rdeck 0.5.2 diff --git a/R/scales.R b/R/scales.R index 229596fa..81197c64 100644 --- a/R/scales.R +++ b/R/scales.R @@ -466,7 +466,6 @@ scale_quantile <- function(col, range = 0:1, na_value = 0, na_value = na_value, data = continuous_identity_range(data), get_breaks = quantile_breaks(probs), - col_label = col_label, col_label = as_labeller(col_label), legend = legend ) diff --git a/tests/testthat/test-scale.R b/tests/testthat/test-scale.R new file mode 100644 index 00000000..6a44cd06 --- /dev/null +++ b/tests/testthat/test-scale.R @@ -0,0 +1,14 @@ +test_that("scale_quantile works", { + expect_equal( + compile(scale_quantile(foo, range = 0:1, data = 0:1, probs = seq.int(0, 1, 0.2))), + list( + scale_type = "threshold", + legend = TRUE, + col = "foo", + na_value = 0, + domain = c(0.2, 0.4, 0.6, 0.8), + range = c(0, 0.25, 0.5, 0.75, 1), + scale_by = "foo" + ) + ) +})