Generate a grid of plots with a shared legend

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

Arguments

...

A set of plots to arrange with a shared legend.

ncol

Number of columns to plot.

nrow

Number of rows to plot.

position

Position of legend ("bottom" or "right").

Value

A ggplot plot

References

https://github.com/tidyverse/ggplot2/wiki/Share-a-legend-between-two-ggplot2-graphs

http://rpubs.com/sjackman/grid_arrange_shared_legend

http://stackoverflow.com/questions/13649473/add-a-common-legend-for-combined-ggplots