add.legend {gg.gap} | R Documentation |
Add Legend to gg.gap()
Description
Add legend to gg.gap().
Usage
add.legend(plot, margin = c(top = 200, right = 200, bottom = 200, left =
200))
Arguments
plot |
A 'ggplot2' plot. |
margin |
Margins around the text. |
Value
A legend-added picture
Examples
library(ggplot2)
mtcars$gear <- factor(mtcars$gear)
bp <- ggplot(data = mtcars, aes(x = gear, fill = gear)) +
geom_bar() +
ggtitle("Number of Cars by Gear") +
xlab("Gears")
gg.gap(plot = bp,
ylim = c(0,16),
segments = c(6,8))
add.legend(plot = bp,
margin = c(top=1,right=1,bottom=1,left=460))
[Package gg.gap version 1.3 Index]