Skip to content

Commit 3fce5e7

Browse files
committed
new key.justification theme element
1 parent ff42a0c commit 3fce5e7

File tree

3 files changed

+12
-0
lines changed

3 files changed

+12
-0
lines changed

R/theme-elements.R

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -586,6 +586,7 @@ el_def <- function(class = NULL, inherit = NULL, description = NULL) {
586586
legend.key.spacing = el_def(c("unit", "rel"), "spacing"),
587587
legend.key.spacing.x = el_def(c("unit", "rel"), "legend.key.spacing"),
588588
legend.key.spacing.y = el_def(c("unit", "rel"), "legend.key.spacing"),
589+
legend.key.justification = el_def(c("character", "numeric", "integer")),
589590
legend.frame = el_def("element_rect", "rect"),
590591
legend.axis.line = el_def("element_line", "line"),
591592
legend.ticks = el_def("element_line", "legend.axis.line"),

R/theme.R

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,10 @@
8484
#' between legend keys given as a `unit`. Spacing in the horizontal (x) and
8585
#' vertical (y) direction inherit from `legend.key.spacing` or can be
8686
#' specified separately. `legend.key.spacing` inherits from `spacing`.
87+
#' @param legend.key.justification Justification for positioning legend keys
88+
#' when more space is available than needed for display. The default, `NULL`,
89+
#' stretches keys into the available space. Can be a location like `"center"`
90+
#' or `"top"`, or a two-element numeric vector.
8791
#' @param legend.frame frame drawn around the bar ([element_rect()]).
8892
#' @param legend.ticks tick marks shown along bars or axes ([element_line()])
8993
#' @param legend.ticks.length length of tick marks in legend
@@ -393,6 +397,7 @@ theme <- function(...,
393397
legend.key.spacing,
394398
legend.key.spacing.x,
395399
legend.key.spacing.y,
400+
legend.key.justification,
396401
legend.frame,
397402
legend.ticks,
398403
legend.ticks.length,

man/theme.Rd

Lines changed: 6 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)