Skip to content

Commit ba0b18a

Browse files
authored
margins can be units (#5932)
1 parent e635262 commit ba0b18a

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

R/theme-elements.R

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -431,7 +431,7 @@ el_def <- function(class = NULL, inherit = NULL, description = NULL) {
431431
text = el_def("element_text"),
432432
title = el_def("element_text", "text"),
433433
spacing = el_def("unit"),
434-
margins = el_def("margin"),
434+
margins = el_def(c("margin", "unit")),
435435

436436
axis.line = el_def("element_line", "line"),
437437
axis.text = el_def("element_text", "text"),
@@ -517,7 +517,7 @@ el_def <- function(class = NULL, inherit = NULL, description = NULL) {
517517
),
518518

519519
legend.background = el_def("element_rect", "rect"),
520-
legend.margin = el_def(c("margin", "rel"), "margins"),
520+
legend.margin = el_def(c("margin", "unit", "rel"), "margins"),
521521
legend.spacing = el_def(c("unit", "rel"), "spacing"),
522522
legend.spacing.x = el_def(c("unit", "rel"), "legend.spacing"),
523523
legend.spacing.y = el_def(c("unit", "rel"), "legend.spacing"),
@@ -566,7 +566,7 @@ el_def <- function(class = NULL, inherit = NULL, description = NULL) {
566566

567567
legend.box = el_def("character"),
568568
legend.box.just = el_def("character"),
569-
legend.box.margin = el_def(c("margin", "rel"), "margins"),
569+
legend.box.margin = el_def(c("margin", "unit", "rel"), "margins"),
570570
legend.box.background = el_def("element_rect", "rect"),
571571
legend.box.spacing = el_def(c("unit", "rel"), "spacing"),
572572

@@ -606,7 +606,7 @@ el_def <- function(class = NULL, inherit = NULL, description = NULL) {
606606
plot.tag = el_def("element_text", "title"),
607607
plot.tag.position = el_def(c("character", "numeric", "integer")), # Need to also accept numbers
608608
plot.tag.location = el_def("character"),
609-
plot.margin = el_def(c("margin", "rel"), "margins"),
609+
plot.margin = el_def(c("margin", "unit", "rel"), "margins"),
610610

611611
aspect.ratio = el_def(c("numeric", "integer"))
612612
)

0 commit comments

Comments
 (0)