Skip to content

Commit

Permalink
get geom args: also retrieve stat args
Browse files Browse the repository at this point in the history
  • Loading branch information
pvictor committed Jan 10, 2025
1 parent d24d8e2 commit 6285253
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: esquisse
Type: Package
Title: Explore and Visualize Your Data Interactively
Version: 2.0.1
Version: 2.0.1.9000
Authors@R: c(person("Fanny", "Meyer", role = c("aut")),
person("Victor", "Perrier", email = "[email protected]", role = c("aut", "cre")),
person("Ian", "Carroll", comment = "Faceting support", role = "ctb"),
Expand Down
8 changes: 8 additions & 0 deletions R/geometries.R
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,14 @@ match_geom_args <- function(geom,
if (!inherits(stat_args, "try-error")) {
geom_args <- c(geom_args, stat_args)
}
} else if (!is.null(geom_args$stat)) {
stat_args <- try(
formals(fun = get(paste0("stat_", geom_args$stat), envir = pkg_envir)),
silent = TRUE
)
if (!inherits(stat_args, "try-error")) {
geom_args <- c(geom_args, stat_args)
}
}
# browser()
if (isTRUE(add_aes)) {
Expand Down
Binary file modified tests/testthat/Rplots.pdf
Binary file not shown.
2 changes: 1 addition & 1 deletion tests/testthat/test-geoms.R
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ test_that("match_geom_args works", {
histo_params <- match_geom_args(geom = "histogram", args = params, add_aes = FALSE)
expect_length(histo_params, 2)
histo_params <- match_geom_args(geom = "violin", args = params)
expect_length(histo_params, 3)
expect_length(histo_params, 4)
})


Expand Down

0 comments on commit 6285253

Please sign in to comment.