easy_add_legend_title: Easily add legend title(s)

View source: R/legend.R

easy_add_legend_titleR Documentation

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)

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?

Value

a theme object

Author(s)

Jonathan Carroll

Examples


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")

ggeasy documentation built on March 31, 2023, 10:34 p.m.