-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
1,945 additions
and
9 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
1,810 changes: 1,810 additions & 0 deletions
1,810
tests/testthat/_snaps/test.geom_blur_dots/blur-types-work-correctly.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
58 changes: 58 additions & 0 deletions
58
...snaps/test.stat_dist_slabinterval/dist-halfeyeh-log-scale-mode-hdi-sym-diff.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# Tests for blurry dot plots | ||
# | ||
# Author: mjskay | ||
############################################################################### | ||
|
||
|
||
test_that("geom_blur_dots displays correctly", { | ||
skip_if_no_vdiffr() | ||
skip_if_no_gradient() | ||
skip_if_not_installed("posterior") | ||
|
||
df = data.frame(x = 0, sd = c(0,0.1,0.25,1,2)) | ||
|
||
vdiffr::expect_doppelganger("blur types work correctly", | ||
ggplot(df, aes(x = x, sd = sd)) + | ||
geom_blur_dots(aes(y = "gaussian")) + | ||
geom_blur_dots(aes(y = "interval 95%"), blur = "interval") + | ||
geom_blur_dots(aes(y = "interval +/- 1sd"), blur = blur_interval(.width = 0.6826895)) + | ||
geom_vline(xintercept = c(-2, -1, -0.25, 0.25, 1, 2), alpha = 0.25), | ||
writer = write_svg_with_gradient | ||
) | ||
}) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# Tests for MCSE dot plots | ||
# | ||
# Author: mjskay | ||
############################################################################### | ||
|
||
|
||
test_that("stat_mcse_dots calculates correctly", { | ||
skip_if_not_installed("posterior") | ||
|
||
set.seed(1234) | ||
x = rnorm(200) | ||
|
||
# MCSE on all points | ||
df_all = layer_data(ggplot() + stat_mcse_dots(aes(x))) | ||
expect_equal(df_all$x, sort(x)) | ||
expect_equal(df_all$sd, posterior::mcse_quantile(x, ppoints(200), names = FALSE)) | ||
|
||
# MCSE on 100 quantiles | ||
df_100 = layer_data(ggplot() + stat_mcse_dots(aes(x), quantiles = 100)) | ||
expect_equal(df_100$x, quantile(x, ppoints(100), type = 5, names = FALSE)) | ||
expect_equal(df_100$sd, posterior::mcse_quantile(x, ppoints(100), names = FALSE)) | ||
}) |
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