Skip to content

Commit aa07be6

Browse files
committed
new margin_auto()
1 parent 642404d commit aa07be6

File tree

4 files changed

+14
-2
lines changed

4 files changed

+14
-2
lines changed

NAMESPACE

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -485,6 +485,7 @@ export(layer_sf)
485485
export(lims)
486486
export(map_data)
487487
export(margin)
488+
export(margin_auto)
488489
export(margin_part)
489490
export(max_height)
490491
export(max_width)

R/margins.R

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,12 @@ margin_part <- function(t = NA, r = NA, b = NA, l = NA, unit = "pt") {
1515
margin(t = t, r = r, b = b, l = l, unit = unit)
1616
}
1717

18+
#' @rdname element
19+
#' @export
20+
margin_auto <- function(t = 0, r = t, b = t, l = r, unit = "pt") {
21+
margin(t = t, r = r, b = b, l = l, unit)
22+
}
23+
1824
is.margin <- function(x) {
1925
inherits(x, "margin")
2026
}

R/theme-elements.R

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111
#' - `element_geom()`: defaults for drawing layers.
1212
#'
1313
#' `rel()` is used to specify sizes relative to the parent,
14-
#' `margin()` and `margin_part()` are used to specify the margins of elements.
14+
#' `margin()`, `margin_part()` and `margin_auto()` are all used to specify the
15+
#' margins of elements.
1516
#'
1617
#' @param fill Fill colour.
1718
#' @param colour,color Line/border colour. Color is an alias for colour.

man/element.Rd

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

0 commit comments

Comments
 (0)