R: set_panel_size

set_panel_size {egg} | R Documentation

## set_panel_size

### Description

Set the panel width/height of a ggplot to a fixed value.

### Usage

    set_panel_size(p = NULL, g = ggplot2::ggplotGrob(p), file = NULL,
      margin = unit(1, "mm"), width = unit(4, "cm"), height = unit(4, "cm"))

### Arguments

`p` | ggplot2
`g` | gtable
`file` | optional output filename
`margin` | grid unit
`width` | grid unit, requested panel width
`height` | grid unit, requested panel height

### Value

gtable with fixed panel sizes

### Examples

    p1 <- qplot(mpg, wt, data=mtcars, colour=cyl)
    p2 <- p1 + facet_wrap(~carb, nrow=1)
    grid.arrange(grobs=lapply(list(p1,p2), set_panel_size))

[Package egg version 0.4.0 Index]