SG.facet_layout: Forced layout in 'facet_wrap()'

Description Usage Arguments See Also Examples

Description

Allows ggplot2 to use bigger layout than usually possible in facet_wrap() given the number of panels. Code from: https://github.com/guiastrennec/ggplus and added 'SG.' for export

Usage

1
2
SG.facet_layout(plot = NULL, facets = NULL, nrow = 2, ncol = 2,
  scales = "fixed")

Arguments

plot

a ggplot object

facets

variables to facet by

nrow

number of rows

ncol

number of columns

scales

should scales be fixed ("fixed", the default), free ("free"), or free in one dimension ("free_x", "free_y")

See Also

facet_wrap, facet_multiple

Examples

1
2
3
4
5
6
7
8
## Not run: 
p <- ggplot(diamonds, aes(x = price, y = carat, color = cut)) + 
geom_point(alpha = 0.5) + 
labs(x = 'Price', y = 'Carat', title = 'Diamonds')

facet_layout(plot = p, facets = 'color', ncol = 4, nrow = 3)

## End(Not run)

FNTD/R-package documentation built on Oct. 18, 2017, 12:59 p.m.