Skip to contents

Quick functions to enable faster and more readable theme adjustments to ggplot2 when positioning the legend. Functions provided are:

  • 'legend_none' disables the legend for a plot

  • 'legend_top' puts the legend in the top position

  • 'legend_bottom' puts the legend in the bottom position

  • 'legend_left' puts the legend in the left position

  • 'legend_right' puts the legend in the right position

Usage

legend_none()

legend_top()

legend_bottom()

legend_left()

legend_right()

Value

A ggplot2 theme object

Examples

library(ggplot2)

ggplot(mtcars, aes(x = mpg, y = hp, colour = factor(cyl))) +
  geom_point() +
  legend_none()


ggplot(mtcars, aes(x = mpg, y = hp, colour = factor(cyl))) +
  geom_point() +
  legend_top()


ggplot(mtcars, aes(x = mpg, y = hp, colour = factor(cyl))) +
  geom_point() +
  legend_bottom()