Skip to content

Commit e47212b

Browse files
author
Yunuuuu
committed
refactor: remove metadata from patch_options
1 parent 2bb2f48 commit e47212b

3 files changed

Lines changed: 37 additions & 44 deletions

File tree

R/alignpatch-.R

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,41 @@ patch.default <- function(x) {
142142
#' @export
143143
patch.NULL <- function(x) NULL
144144

145+
#' Options passed to the Patch `gtable` method
146+
#'
147+
#' This class defines the options that can be passed to the `gtable` method of a
148+
#' `Patch` object. It includes:
149+
#'
150+
#' - `theme`: The theme to be applied, which can be either `NULL` or a ggplot2
151+
#' [theme][ggplot2::theme] object.
152+
#' - `guides`: The guides for the plot, which can be `NULL` or a character
153+
#' vector.
154+
#' - `tag`: Can be `NULL` (no tag), a single string, or a `LayoutTagger` object
155+
#' that provides a `$tag()` method to generate a tag string for each plot.
156+
#' The `LayoutTagger` is used specifically by [`alignpatches()`]. For
157+
#' individual plots, you typically call the `$tag()` method of the
158+
#' `LayoutTagger` object to return a string, which triggers the internal
159+
#' `Patch$tag()` method to add a tag.
160+
#'
161+
#' @keywords internal
162+
patch_options <- S7::new_class("patch_options",
163+
properties = list(
164+
theme = S7::new_union(NULL, ggplot2::class_theme),
165+
guides = S7::new_union(NULL, S7::class_character),
166+
tag = S7::new_property(
167+
S7::new_union(
168+
NULL, S7::class_character,
169+
S7::new_S3_class("ggalign::LayoutTagger")
170+
),
171+
validator = function(value) {
172+
if (is.character(value) && length(value) != 1L) {
173+
return("must be a single string or `LayoutTagger` object")
174+
}
175+
}
176+
)
177+
)
178+
)
179+
145180
#' Patch object
146181
#'
147182
#' @usage NULL

R/alignpatch-alignpatches.R

Lines changed: 0 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -158,45 +158,6 @@ LAYOUT_FOREGROUND_Z <- 3L
158158
GUIDE_LEGENDS_Z <- 4L
159159
TAGS_Z <- 5L
160160

161-
#' Options passed to the Patch `gtable` method
162-
#'
163-
#' This class defines the options that can be passed to the `gtable` method of a
164-
#' `Patch` object. It includes:
165-
#'
166-
#' - `theme`: The theme to be applied, which can be either `NULL` or a ggplot2
167-
#' [theme][ggplot2::theme] object.
168-
#' - `guides`: The guides for the plot, which can be `NULL` or a character
169-
#' vector.
170-
#' - `tag`: Can be `NULL` (no tag), a single string, or a `LayoutTagger` object
171-
#' that provides a `$tag()` method to generate a tag string for each plot.
172-
#' The `LayoutTagger` is used specifically by [`alignpatches()`]. For
173-
#' individual plots, you typically call the `$tag()` method of the
174-
#' `LayoutTagger` object to return a string, which triggers the internal
175-
#' `Patch$tag()` method to add a tag.
176-
#' - `metadata`: A list of additional metadata. This can store any extra
177-
#' information relevant to the patch, such as custom parameters or auxiliary
178-
#' data that do not fit into the other categories.
179-
#'
180-
#' @keywords internal
181-
patch_options <- S7::new_class("patch_options",
182-
properties = list(
183-
theme = S7::new_union(NULL, ggplot2::class_theme),
184-
guides = S7::new_union(NULL, S7::class_character),
185-
tag = S7::new_property(
186-
S7::new_union(
187-
NULL, S7::class_character,
188-
S7::new_S3_class("ggalign::LayoutTagger")
189-
),
190-
validator = function(value) {
191-
if (is.character(value) && length(value) != 1L) {
192-
return("must be a single string or `LayoutTagger` object")
193-
}
194-
}
195-
),
196-
metadata = S7::class_list
197-
)
198-
)
199-
200161
#' @importFrom ggplot2 ggproto
201162
#' @noRd
202163
PatchAlignpatches <- ggproto(

man/patch_options.Rd

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

0 commit comments

Comments
 (0)