grid_arrange_shared_legend: ggplot multiple plot per page

Description Usage Arguments Value Examples

Description

This function allows to plot multiple ggplot plots in the same page while keepin the same legend.

Usage

1
2
grid_arrange_shared_legend(..., ncol = length(list(...)), nrow = 1,
  position = c("bottom", "right"))

Arguments

...

Type: ggplot. Input any ggplot you want.

ncol

Type: integer. The number of columns in your final page. Defaults to "length(list(...))".

nrow

Type: itneger The number of rows in your final page. Defaults to 1.

position

Type: character. Where to put the legend. Defaults to c("bottom", "right")

Value

The requested ggplots in the same page.

Examples

1
2
3
4
5
6
7
## Not run: 
dataset(mtcars)
p1 <- ggplot(mtcars, aes(x = mpg, y = as.factor(cyl), fill = vs)) + geom_point()
p2 <- ggplot(mtcars, aes(x = mpg, y = as.factor(cyl), fill = vs)) + geom_boxplot()
grid_arrange_shared_legend(p1, p2)

## End(Not run)

Laurae2/Laurae documentation built on May 8, 2019, 7:59 p.m.