grid_arrange_shared_legend: Common-Legend Arrangement of Plots

View source: R/plots.R

grid_arrange_shared_legendR Documentation

Common-Legend Arrangement of Plots

Description

This function creates a common legend for the given pots to share This was taken from the following link: https://github.com/tidyverse/ggplot2/wiki/Share-a-legend-between-two-ggplot2-graphs

Usage

grid_arrange_shared_legend(
  ...,
  list = NULL,
  ncol = NULL,
  nrow = 1,
  position = c("bottom", "right"),
  legend = NULL,
  legend_plot = NULL
)

Arguments

...

A series of plots to share a common legend

list

A list of plots to share a common legend. Defaults to NULL. If list is specified, ellipsis argument is ignored.

ncol

Number of columns of the arranged plots. Defaults to NULL, in which case it is the length of the list.

nrow

Number of rows of the arranged plots

position

Position of the legend

legend

If legend is supplied from outside. Defaults to NULL.

legend_plot

If plot to pull the legend from is supplied from outside. Defaults to NULL.


sysilviakim/Kmisc documentation built on Jan. 28, 2023, 10:58 a.m.