-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update stat_ecdf to work either on the x or the y aesthetic. (#4005)
* Update stat_ecdf to work either on the x or the y aesthetic, whatever is provided. * Undo breaking change of renaming the stats result and go back to y. * Add bullet to NEWS.md * Fix typo in comments. * Improve comment. * Document Co-authored-by: GitHub Actions <actions@github.com>
- Loading branch information
1 parent
f0e561e
commit ca24e27
Showing
4 changed files
with
52 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
context("stat_ecdf") | ||
|
||
test_that("stat_ecdf works in both directions", { | ||
p <- ggplot(mpg, aes(hwy)) + stat_ecdf() | ||
x <- layer_data(p) | ||
expect_false(x$flipped_aes[1]) | ||
|
||
p <- ggplot(mpg, aes(y = hwy)) + stat_ecdf() | ||
y <- layer_data(p) | ||
expect_true(y$flipped_aes[1]) | ||
|
||
x$flipped_aes <- NULL | ||
y$flipped_aes <- NULL | ||
expect_identical(x, flip_data(y, TRUE)[,names(x)]) | ||
}) | ||
|