A one-liner to arrange legend keys horizontally. Useful for legends placed at the top or bottom of a plot.
Examples
library(ggplot2)
# Horizontal legend at bottom
ggplot(mtcars, aes(mpg, wt, color = factor(cyl))) +
geom_point() +
legend_bottom() +
legend_horizontal()