ggplotShareLeg: ggplotShareLeg

Description Usage Arguments Value Examples

Description

A function to plot multiple ggplot objects with a shared legend. HFG: from https://github.com/hadley/ggplot2/wiki/Share-a-legend-between-two-ggplot2-graphs

Usage

1

Arguments

...

Some number of ggplot objects.

Value

A multiple panel plot of plots with a common legend.

Examples

1
2
3
4
5
6
dsamp <- diamonds[sample(nrow(diamonds), 1000), ]
p1 <- qplot(carat, price, data=dsamp, colour=clarity)
p2 <- qplot(cut, price, data=dsamp, colour=clarity)
p3 <- qplot(color, price, data=dsamp, colour=clarity)
p4 <- qplot(depth, price, data=dsamp, colour=clarity)
ggplotShareLeg(p1, p2, p3, p4)

hferg/hfgr documentation built on May 17, 2019, 3:56 p.m.