Learn R Programming

ggeasy (version 0.1.4)

easy_add_legend_title: Easily add legend title(s)

Description

Update the title(s) of the specified aesthetic, or all aesthetics at once.

Usage

easy_add_legend_title(..., teach = FALSE)

Value

a theme object

Arguments

...

A list of new name-value pairs. The name should be an aesthetic. If only a character value is provided then all legend titles will be changed to that.

teach

print longer equivalent ggplot2 expression?

Author

Jonathan Carroll

Examples

Run this code

library(ggplot2)

# Add legend title to a specific aesthetic
ggplot(mtcars, aes(wt, mpg, colour = cyl, size = hp)) +
  geom_point() + easy_add_legend_title(col = "Number of Cylinders")

# Add legend title to all aesthetics
ggplot(mtcars, aes(wt, mpg, colour = cyl)) +
  geom_point() + easy_add_legend_title("Number of Cylinders")

Run the code above in your browser using DataLab