title: How to change the number of legend items per rows in ggplot
body: <p>Having the dataset, reproducible with the code:</p>
  <pre><code>df &lt;- data.frame(&quot;ID&quot;=rep(c(1:20),2), &quot;time&quot;=c(rep(1,20),rep(2,20)), &quot;value&quot;=c(&quot;A&quot;,&quot;B&quot;,&quot;B&quot;,&quot;C&quot;,&quot;B&quot;,rep(&quot;D&quot;,3),rep(&quot;B&quot;,2),&quot;E&quot;,rep(&quot;F&quot;,3),&quot;A&quot;,rep(&quot;B&quot;,6),&quot;C&quot;,&quot;D&quot;,&quot;A&quot;,&quot;B&quot;,rep(&quot;F&quot;,3),rep(&quot;B&quot;,2),&quot;A&quot;,rep(&quot;B&quot;,3),&quot;D&quot;,&quot;A&quot;,&quot;D&quot;,rep(&quot;B&quot;,2),&quot;F&quot;))
  </code></pre>
  <p>I'm using ggplot, but I can't manage the items of the legend over different number of rows, using the following code:</p>
  <pre><code>library(ggplot2)
  library(ggalluvial)
  
  ggplot(df, 
         aes(x = time, stratum = value, alluvium = ID,
             fill = value, label = value)) +
    #scale_fill_viridis_d() +
    scale_fill_manual(values = colors) +
    #scale_fill_brewer(type = &quot;qual&quot; , palette = &quot;Set3&quot;) +
    scale_y_continuous(breaks = seq(0, n_id, length.out = 11), label = scales::percent_format(scale = 100 / n_id, accuracy = 1)) +
    geom_flow(stat = &quot;flow&quot;, knot.pos = 1/4, aes.flow = &quot;forward&quot;,
              color = &quot;gray&quot;) + 
    geom_stratum() +
    theme(legend.position = &quot;bottom&quot;) +
    #guides(fill = guide_legend(title = &quot; &quot;)) + 
    guides(colour = guide_legend(nrow = 1, byrow = TRUE))
  </code></pre>
  <p>In particular, <code>guides(colour = guide_legend(nrow = 1, byrow = TRUE))</code>does not work, and the items of the legend are on two rows (instead of one, as I would have).</p>
  <p>What am I doing wrong?</p>