I want to know how to increase the space between legend items in ggplot. This comes in handy when you have more involved plots and the viewer needs a clear legend of a color gradient, which is sometimes hard to see when you don't have enough whitespace between the parts of a color gradient.
REPREX
data(iris)
iris$Sepal.Length.cut<-cut(iris$Sepal.Length, breaks=seq(4,8,1), labels=c("here","and here","here too", "here three"))
iris.grad<-colorRampPalette(c("darkgoldenrod","darkgoldenrod4"))
iris.col<-iris.grad(4)
names(iris.col)<-levels(iris$Sepal.Length.cut)
ggplot(iris)+
geom_bar(aes(x=Species,fill=Sepal.Length.cut), stat="count")+
scale_fill_manual(values=iris.col, name="increase space \n where indicated")+
theme(legend.spacing.y=unit(1.5,"lines"))
legend.spacing.y only increases the space between the title and the legend elements, increasing the key size doesn't get rid of the problem. Interestingly enought this solution actually says it should and their reprex works for me... maybe its the difference between bars and points?