Skip to content

Commit 58cb96e

Browse files
committed
add ... to pass arguments to fortify_matrix
1 parent f6f2083 commit 58cb96e

File tree

7 files changed

+29
-11
lines changed

7 files changed

+29
-11
lines changed

R/cross-.R

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Since `ggalign_align_plot` object need act with the layout, we Use R6 object
22
# here
3-
cross <- function(cross, data = waiver(), ...,
3+
cross <- function(cross, data = waiver(),
4+
data_params = list(), ...,
45
inherit_index = NULL,
56
inherit_panel = NULL,
67
inherit_nobs = NULL,
@@ -11,7 +12,7 @@ cross <- function(cross, data = waiver(), ...,
1112
}
1213
new_ggalign_plot(
1314
align = cross,
14-
data = allow_lambda(data),
15+
data = allow_lambda(data), data_params = data_params,
1516
...,
1617
inherit_nobs = inherit_nobs,
1718
inherit_panel = inherit_panel,
@@ -26,6 +27,7 @@ cross <- function(cross, data = waiver(), ...,
2627
Cross <- ggproto("Cross", AlignProto,
2728
free_facet = TRUE,
2829
free_limits = TRUE,
30+
data_params = NULL,
2931
inherit_nobs = NULL,
3032
inherit_panel = NULL,
3133
inherit_index = NULL,
@@ -78,7 +80,7 @@ Cross <- ggproto("Cross", AlignProto,
7880
} else {
7981
data <- input_data
8082
}
81-
data <- fortify_matrix(data) %|w|% NULL
83+
data <- inject(fortify_matrix(data, !!!self$data_params)) %|w|% NULL
8284
if (isTRUE(self$inherit_nobs)) { # we require inherit nobs
8385
# we check if the data match original data dimention
8486
if (!is.null(data) &&

R/cross-link.R

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
#' needed.
1414
#'
1515
#' @export
16-
cross_link <- function(link, data = waiver(), on_top = TRUE,
17-
reorder = NULL, obs_size = 1,
16+
cross_link <- function(link, data = waiver(), ...,
17+
on_top = TRUE, reorder = NULL, obs_size = 1,
1818
inherit_index = NULL, inherit_panel = NULL,
1919
inherit_nobs = NULL,
2020
size = NULL, active = NULL) {
@@ -26,7 +26,8 @@ cross_link <- function(link, data = waiver(), on_top = TRUE,
2626
assert_active(active)
2727
active <- update_active(active, new_active(use = TRUE))
2828
cross(CrossLink,
29-
data = data, link = link, reorder = reorder, obs_size = obs_size,
29+
data = data, data_params = list2(...),
30+
link = link, reorder = reorder, obs_size = obs_size,
3031
plot = ggplot(), size = size,
3132
schemes = default_schemes(),
3233
active = active,

R/cross-mark.R

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@
2323
#' You can use [`scheme_data()`] to modify the internal data if needed.
2424
#'
2525
#' @export
26-
cross_mark <- function(mark, data = waiver(), reorder = NULL, obs_size = 1,
26+
cross_mark <- function(mark, data = waiver(), ...,
27+
reorder = NULL, obs_size = 1,
2728
inherit_index = NULL, inherit_panel = NULL,
2829
inherit_nobs = NULL,
2930
size = NULL, active = NULL) {
@@ -35,7 +36,8 @@ cross_mark <- function(mark, data = waiver(), reorder = NULL, obs_size = 1,
3536
assert_active(active)
3637
active <- update_active(active, new_active(use = TRUE))
3738
cross(CrossMark,
38-
data = data, mark = mark, reorder = reorder, obs_size = obs_size,
39+
data = data, data_params = list2(...),
40+
mark = mark, reorder = reorder, obs_size = obs_size,
3941
plot = ggplot(), size = size,
4042
schemes = default_schemes(th = theme_panel_border()),
4143
active = active,

R/cross-none.R

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
#' [`fortify_matrix()`] will convert the data to a matrix. This argument
55
#' allows you to change the layout data. If not specified, the original data
66
#' will be used.
7+
#' @param ... <[dyn-dots][rlang::dyn-dots]> Additional arguments passed to
8+
#' [`fortify_matrix()`].
79
#' @param inherit_index A boolean value indicating whether to inherit the
810
#' ordering index. If `TRUE`, will match the layout ordering index with the
911
#' data names.
@@ -13,13 +15,12 @@
1315
#' number of observations (nobs). If `TRUE`, the `data` input must be
1416
#' compatible with the layout data.
1517
#' @export
16-
cross_none <- function(data = waiver(),
18+
cross_none <- function(data = waiver(), ...,
1719
inherit_index = NULL,
1820
inherit_panel = NULL,
1921
inherit_nobs = NULL) {
2022
cross(CrossNone,
21-
data = data,
22-
plot = NULL,
23+
data = data, data_params = list2(...), plot = NULL,
2324
active = new_active(use = FALSE),
2425
schemes = default_schemes(),
2526
inherit_index = inherit_index,

man/cross_link.Rd

Lines changed: 4 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/cross_mark.Rd

Lines changed: 4 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/cross_none.Rd

Lines changed: 4 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)