Learn R Programming

ggguides (version 1.1.4)

legend_vertical: Set Legend Direction to Vertical

Description

A one-liner to arrange legend keys vertically. This is the default for legends placed on the left or right of a plot.

Usage

legend_vertical()

Arguments

Value

A ggplot2 theme object that can be added to a plot.

See Also

legend_horizontal, legend_left, legend_right

Examples

Run this code
library(ggplot2)

# Explicitly set vertical direction
ggplot(mtcars, aes(mpg, wt, color = factor(cyl))) +
  geom_point() +
  legend_right() +
  legend_vertical()

Run the code above in your browser using DataLab