grid_arrange_shared_legend: Create a grid of multiple ggplots sharing the same legend

Description Usage Arguments Value

View source: R/effect_plot_helpers.R

Description

Function to create a grid of multiple ggplots sharing the same legend. Note: This function is based on a code example shown on the tidyverse GitHub page (last access: 25.10.2017)

Usage

1
2
3
grid_arrange_shared_legend(..., nrow = 1, ncol = length(list(...)),
  legend_position = c("bottom", "right"), main = NULL, sub = NULL,
  outer_fontsize = 15, newpage = TRUE)

Arguments

...

Multiple ggplot objects

nrow, ncol

Parameters specifying the grid to arrange the ggplots in. Defaults to one row and multiple columns for the plots.

legend_position

The legend can be plotted at the "bottom" or on the "right" of all plots

main, sub

Text over and under the whole graphic, respectively

outer_fontsize

Fontsize of main and sub. Defaults to 15.

newpage

If TRUE, grid.newpage is called before plot creation. This is necessary for the plot window in R, but should be suppressed if one exports the plot, e.g. using pdf

Value

Silently returns the plot object


bauer-alex/FoSIntro documentation built on Feb. 11, 2022, 8:33 a.m.