In the following example, I use both pattern and fill. The legend has to be below the plot. How can force the legend in one row?
I can't get guides(fill=guide_legend(nrow=1)), as used here, to work.

My Code:
library(ggplot2)
library(ggpattern)
g <- ggplot(mpg, aes(cty, hwy, group=trans, fill=trans, colour=trans))
g + geom_col_pattern(
aes(
pattern_angle=trans),
pattern_fill='black',
pattern_colour=NA,
pattern='stripe',
position=position_dodge()) +
scale_pattern_angle_discrete(labels=c(1:10)
)+
scale_fill_discrete(labels=c(1:10)
)+
scale_colour_discrete(labels=c(1:10)
)+
theme(legend.position = "bottom") +
guides(colour = guide_legend(nrow = 1))+
guides(fill = guide_legend(nrow = 1))+
guides(pattern = guide_legend(nrow = 1))
You are mapping on the
pattern_angleaes. Hence you have to set the number of rows for thepattern_angleguide instead ofpattern.