| guide_legends {ggplot2} | R Documentation |
Build legends, merging where possible
guide_legends(scales, layers, default_mapping, theme)
scales |
|
layers |
|
default_mapping |
|
theme |
A list of grobs
Hadley Wickham <h.wickham@gmail.com>
theme_update(legend.background = theme_rect(size = 0.2))
qplot(mpg, wt, data = mtcars)
qplot(mpg, wt, data = mtcars, colour = cyl)
# Legend with should expand to fit name
qplot(mpg, wt, data = mtcars, colour = factor(cyl))
qplot(mpg, wt, data = mtcars, colour = cyl) +
opts(legend.position = c(0.5, 0.5),
legend.background = theme_rect(fill = "white", col = NA))
mtcars$cyl2 <- factor(mtcars$cyl,
labels = c("a", "loooooooooooong", "two\nlines"))
qplot(mpg, wt, data = mtcars, colour = cyl2)
theme_set(theme_grey())