1context("stat_ecdf") 2 3test_that("stat_ecdf works in both directions", { 4 p <- ggplot(mpg, aes(hwy)) + stat_ecdf() 5 x <- layer_data(p) 6 expect_false(x$flipped_aes[1]) 7 8 p <- ggplot(mpg, aes(y = hwy)) + stat_ecdf() 9 y <- layer_data(p) 10 expect_true(y$flipped_aes[1]) 11 12 x$flipped_aes <- NULL 13 y$flipped_aes <- NULL 14 expect_identical(x, flip_data(y, TRUE)[,names(x)]) 15}) 16 17