equal_margins: Set equal ggplot2 margins

Description Usage Arguments Value Examples

View source: R/plot.R

Description

Sets theme and scales so that the blank area around the plotting area is the same width on all four sides.

Usage

1
equal_margins(margin = ggplot2::unit(0.5, "inches"))

Arguments

margin

ggplot2::unit() object with required margin size.

Value

list appropriate for adding directly to ggplot2 object

Examples

1
2
3
4
5
6
7
library(ggplot2)
rect <- data.frame(x = 0, y = 0)
p <- rect %>% 
  ggplot(aes(xmin = x, xmax = x + 1, ymin = y, ymax = y + 1)) +
    geom_rect(fill = "black")
p     
p + equal_margins()

cwickham/routes documentation built on Nov. 4, 2019, 9:34 a.m.