I have a ggplot2 plot as follows:
library(ggplot2)
ggplot(mtcars, aes(factor(cyl), fill=factor(cyl))) +
geom_bar() +
coord_flip() +
theme(legen
With ggplot2 v3.0.0, we can use legend.spacing.x
to manipulate the space between legend keys.
library(ggplot2)
ggplot(mtcars, aes(factor(cyl), fill = factor(cyl))) +
geom_bar() +
coord_flip() +
theme(legend.position = 'top') +
guides(fill = guide_legend(title = "Cyl")) +
theme(legend.spacing.x = unit(0.5, 'cm'))
Created on 2018-05-30 by the reprex package (v0.2.0).