Skip to content

Commit 7cf8967

Browse files
committed
add test
1 parent b323ede commit 7cf8967

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

tests/testthat/test-stat-ydensity.R

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,3 +41,15 @@ test_that("mapped_discrete class is preserved", {
4141
expect_s3_class(ld$x, "mapped_discrete")
4242
expect_equal(unique(ld$x), c(1, 3))
4343
})
44+
45+
test_that("quantiles are based on actual data (#4120)", {
46+
47+
df <- data.frame(y = 0:10)
48+
q <- seq(0.1, 0.9, by = 0.1)
49+
50+
p <- ggplot(df, aes("X", y)) +
51+
stat_ydensity(draw_quantiles = q)
52+
ld <- get_layer_data(p)
53+
54+
expect_equal(ld$y[!is.na(ld$quantile)], 1:9)
55+
})

0 commit comments

Comments
 (0)