|
17 | 17 | #' differently from the plot's theme settings. The `theme` argument in the
|
18 | 18 | #' guide overrides, and is combined with, the plot's theme.
|
19 | 19 | #' @param position A character string indicating where the legend should be
|
20 |
| -#' placed relative to the plot panels, or a numeric value of length two |
21 |
| -#' setting the placement of legends. |
| 20 | +#' placed relative to the plot panels. |
22 | 21 | #' @param direction A character string indicating the direction of the guide.
|
23 | 22 | #' One of "horizontal" or "vertical".
|
24 | 23 | #' @param override.aes A list specifying aesthetic parameters of legend key.
|
@@ -117,13 +116,7 @@ guide_legend <- function(
|
117 | 116 | theme <- deprecated_guide_args(theme, ...)
|
118 | 117 |
|
119 | 118 | if (!is.null(position)) {
|
120 |
| - if (is.numeric(position)) { |
121 |
| - if (length(position) != 2L) { |
122 |
| - cli::cli_abort("{.arg position} must be a numeric of length 2") |
123 |
| - } |
124 |
| - } else { |
125 |
| - position <- arg_match0(position, c(.trbl, "inside")) |
126 |
| - } |
| 119 | + position <- arg_match0(position, c(.trbl, "inside")) |
127 | 120 | }
|
128 | 121 |
|
129 | 122 | new_guide(
|
@@ -176,18 +169,18 @@ GuideLegend <- ggproto(
|
176 | 169 | hashables = exprs(title, key$.label, name),
|
177 | 170 |
|
178 | 171 | elements = list(
|
179 |
| - background = "legend.background", |
180 |
| - margin = "legend.margin", |
181 |
| - key = "legend.key", |
182 |
| - key_height = "legend.key.height", |
183 |
| - key_width = "legend.key.width", |
184 |
| - text = "legend.text", |
185 |
| - theme.title = "legend.title", |
186 |
| - spacing_x = "legend.key.spacing.x", |
187 |
| - spacing_y = "legend.key.spacing.y", |
188 |
| - text_position = "legend.text.position", |
189 |
| - title_position = "legend.title.position", |
190 |
| - byrow = "legend.byrow" |
| 172 | + background = "legend.background", |
| 173 | + margin = "legend.margin", |
| 174 | + key = "legend.key", |
| 175 | + key_height = "legend.key.height", |
| 176 | + key_width = "legend.key.width", |
| 177 | + text = "legend.text", |
| 178 | + theme.title = "legend.title", |
| 179 | + spacing_x = "legend.key.spacing.x", |
| 180 | + spacing_y = "legend.key.spacing.y", |
| 181 | + text_position = "legend.text.position", |
| 182 | + title_position = "legend.title.position", |
| 183 | + byrow = "legend.byrow" |
191 | 184 | ),
|
192 | 185 |
|
193 | 186 | extract_params = function(scale, params,
|
@@ -569,7 +562,6 @@ GuideLegend <- ggproto(
|
569 | 562 | t = 1, r = -1, b = -1, l = 1, z = -Inf
|
570 | 563 | )
|
571 | 564 | }
|
572 |
| - |
573 | 565 | gt
|
574 | 566 | }
|
575 | 567 | )
|
|
0 commit comments