|
152 | 152 | #' to the extend of the strip background? Options are `"on"` to clip, `"off"`
|
153 | 153 | #' to disable clipping or `"inherit"` (default) to take the clipping setting
|
154 | 154 | #' from the parent viewport.
|
155 |
| -#' @param strip.text,strip.text.x,strip.text.y facet labels ([element_text()]; |
156 |
| -#' inherits from `text`). Horizontal facet labels (`strip.text.x`) & vertical |
| 155 | +#' @param strip.text,strip.text.x,strip.text.y,strip.text.x.top,strip.text.x.bottom,strip.text.y.left,strip.text.y.right |
| 156 | +#' facet labels ([element_text()]; inherits from `text`). Horizontal facet labels (`strip.text.x`) & vertical |
157 | 157 | #' facet labels (`strip.text.y`) inherit from `strip.text` or can be specified
|
158 |
| -#' separately |
| 158 | +#' separately. Facet strips have dedicated position-dependent theme elements |
| 159 | +#' (`strip.text.x.top`, `strip.text.x.bottom`, `strip.text.y.left`, `strip.text.y.right`) |
| 160 | +#' that inherit from `strip.text.x` and `strip.text.y`, respectively. |
| 161 | +#' As a consequence, some theme stylings need to be applied to |
| 162 | +#' the position-dependent elements rather than to the parent elements |
159 | 163 | #' @param strip.switch.pad.grid space between strips and axes when strips are
|
160 | 164 | #' switched (`unit`)
|
161 | 165 | #' @param strip.switch.pad.wrap space between strips and axes when strips are
|
|
266 | 270 | #'
|
267 | 271 | #' p3 + theme(strip.background = element_rect(colour = "black", fill = "white"))
|
268 | 272 | #' p3 + theme(strip.text.x = element_text(colour = "white", face = "bold"))
|
| 273 | +#' # More direct strip.text.x here for top |
| 274 | +#' # as in the facet_wrap the default strip.position is "top" |
| 275 | +#' p3 + theme(strip.text.x.top = element_text(colour = "white", face = "bold")) |
269 | 276 | #' p3 + theme(panel.spacing = unit(1, "lines"))
|
270 | 277 | #' }
|
271 | 278 | theme <- function(line,
|
@@ -358,13 +365,16 @@ theme <- function(line,
|
358 | 365 | strip.placement,
|
359 | 366 | strip.text,
|
360 | 367 | strip.text.x,
|
| 368 | + strip.text.x.bottom, |
| 369 | + strip.text.x.top, |
361 | 370 | strip.text.y,
|
| 371 | + strip.text.y.left, |
| 372 | + strip.text.y.right, |
362 | 373 | strip.switch.pad.grid,
|
363 | 374 | strip.switch.pad.wrap,
|
364 | 375 | ...,
|
365 | 376 | complete = FALSE,
|
366 |
| - validate = TRUE |
367 |
| - ) { |
| 377 | + validate = TRUE) { |
368 | 378 | elements <- find_args(..., complete = NULL, validate = NULL)
|
369 | 379 |
|
370 | 380 | if (!is.null(elements$axis.ticks.margin)) {
|
|
0 commit comments