powered by
A one-liner to arrange legend keys horizontally. Useful for legends placed at the top or bottom of a plot.
legend_horizontal()
A ggplot2 theme object that can be added to a plot.
legend_vertical, legend_top, legend_bottom
legend_vertical
legend_top
legend_bottom
library(ggplot2) # Horizontal legend at bottom ggplot(mtcars, aes(mpg, wt, color = factor(cyl))) + geom_point() + legend_bottom() + legend_horizontal()
Run the code above in your browser using DataLab