easy_remove_legend: Easily remove legend(s)

Description Usage Arguments Value Author(s) Examples

View source: R/legend.R

Description

With no argument, will remove all legends. Provide the name(s) of specific aesthetic to remove only certain legends.

Usage

1

Arguments

...

optional name(s) specific aesthetics for which to remove the legend

teach

print longer equivalent ggplot2 expression?

Value

either a theme object or a guidesobject, both of which can be used in ggplot2 calls

Author(s)

Alicia Schep

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
library(ggplot2)

# Remove all legends
ggplot(mtcars, aes(wt, mpg, colour = cyl, size = hp)) +
  geom_point() + easy_remove_legend()

# remove just size legend
ggplot(mtcars, aes(wt, mpg, colour = cyl, size = hp)) +
  geom_point() + easy_remove_legend("size")

# can also use:
ggplot(mtcars, aes(wt, mpg, colour = cyl, size = hp)) +
  geom_point() + easy_remove_legend(size)

# Remove more than one
ggplot(mtcars, aes(wt, mpg, colour = cyl, size = hp)) +
  geom_point() + easy_remove_legend(size, color)

ggeasy documentation built on Jan. 7, 2021, 9:08 a.m.