Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Change density defaultbw = "nrd0" tobw = "sj"#5854

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Draft
teunbrand wants to merge4 commits intotidyverse:main
base:main
Choose a base branch
Loading
fromteunbrand:density_bw_to_SJ
Draft
Show file tree
Hide file tree
Changes from1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
PrevPrevious commit
NextNext commit
adapt tests
  • Loading branch information
@teunbrand
teunbrand committedApr 22, 2024
commit950ca52e909afa746633c386821e8f64e180c84f
6 changes: 3 additions & 3 deletionstests/testthat/_snaps/geom-violin/basic.svg
View file
Open in desktop
Loading
Sorry, something went wrong.Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View file
Open in desktop
Loading
Sorry, something went wrong.Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View file
Open in desktop
Loading
Sorry, something went wrong.Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 3 additions & 3 deletionstests/testthat/_snaps/geom-violin/coord-flip.svg
View file
Open in desktop
Loading
Sorry, something went wrong.Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 3 additions & 3 deletionstests/testthat/_snaps/geom-violin/coord-polar.svg
View file
Open in desktop
Loading
Sorry, something went wrong.Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View file
Open in desktop
Loading
Sorry, something went wrong.Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 3 additions & 3 deletionstests/testthat/_snaps/geom-violin/dodging.svg
View file
Open in desktop
Loading
Sorry, something went wrong.Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View file
Open in desktop
Loading
Sorry, something went wrong.Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 6 additions & 6 deletionstests/testthat/_snaps/geom-violin/grouping-on-x-and-fill.svg
View file
Open in desktop
Loading
Sorry, something went wrong.Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 3 additions & 3 deletionstests/testthat/_snaps/geom-violin/narrower-width-5.svg
View file
Open in desktop
Loading
Sorry, something went wrong.Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
24 changes: 12 additions & 12 deletionstests/testthat/_snaps/geom-violin/quantiles.svg
View file
Open in desktop
Loading
Sorry, something went wrong.Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View file
Open in desktop
Loading
Sorry, something went wrong.Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View file
Open in desktop
Loading
Sorry, something went wrong.Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
200 changes: 99 additions & 101 deletionstests/testthat/_snaps/geom-violin/with-tails-and-points.svg
View file
Open in desktop
Loading
Sorry, something went wrong.Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletiontests/testthat/_snaps/stat-ydensity.md
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -4,5 +4,5 @@

---

`test` is not a valid bandwidth rule.
`bw` must be one of "nrd0", "nrd", "ucv", "bcv", "sj", "sj-ste", or "sj-dpi", not "test".

4 changes: 2 additions & 2 deletionstests/testthat/test-geom-violin.R
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -8,8 +8,8 @@ test_that("range is expanded", {
geom_violin(trim = FALSE) +
facet_grid(x ~ ., scales = "free") +
coord_cartesian(expand = FALSE)
expand_a <- stats::bw.nrd0(df$y[df$x == "a"]) * 3
expand_b <- stats::bw.nrd0(df$y[df$x == "b"]) * 3
expand_a <- stats::bw.SJ(df$y[df$x == "a"]) * 3
expand_b <- stats::bw.SJ(df$y[df$x == "b"]) * 3
expect_equal(layer_scales(p, 1)$y$dimension(), c(0 - expand_a, 1 + expand_a))
expect_equal(layer_scales(p, 2)$y$dimension(), c(0 - expand_b, 2 + expand_b))
})
Expand Down
6 changes: 3 additions & 3 deletionstests/testthat/test-stat-density.R
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
test_that("stat_density actually computes density", {
# Compare functon approximations because outputs from `ggplot()` and
# `density()` give grids spanning different ranges
dens <- stats::density(mtcars$mpg)
dens <- stats::density(mtcars$mpg, bw = "sj")
expected_density_fun <- stats::approxfun(data.frame(x = dens$x, y = dens$y))

plot <- ggplot(mtcars, aes(mpg)) + stat_density()
Expand All@@ -19,7 +19,7 @@ test_that("stat_density can make weighted density estimation", {
df <- mtcars
df$weight <- mtcars$cyl / sum(mtcars$cyl)

dens <- stats::density(df$mpg, weights = df$weight, bw = bw.nrd0(df$mpg))
dens <- stats::density(df$mpg, weights = df$weight, bw = bw.SJ(df$mpg))
expected_density_fun <- stats::approxfun(data.frame(x = dens$x, y = dens$y))

plot <- ggplot(df, aes(mpg, weight = weight)) + stat_density()
Expand All@@ -38,7 +38,7 @@ test_that("stat_density uses `bounds`", {
mpg_max <- max(mtcars$mpg)

expect_bounds <- function(bounds) {
dens <- stats::density(mtcars$mpg)
dens <- stats::density(mtcars$mpg, bw = "sj")
orig_density <- stats::approxfun(
data.frame(x = dens$x, y = dens$y),
yleft = 0,
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp