title: ggplot2 legend items in a single horizontal row
body: <p>It seems that the code I wrote and tested last week has now suddenly decided to change the output even though nothing in the code or the version of R or Rstudio has changed.</p>
  <p>Previously when I drew a plot with ggplot2 and asked for the legend to appear at the bottom of the plot, it automatically oriented the items into a single horizontal row. Now when I run the same code it places the item in a number of 2-row columns.</p>
  <p>Here's an example:</p>
  <pre><code>mtcars$cyl &lt;- (1:32)
  subcars &lt;- subset(mtcars, cyl&lt;10)
  subcars$cyl &lt;- as.factor(subcars$cyl)
  
  ggplot(subcars, aes(carb, mpg, group=cyl, colour=cyl)) + 
    geom_line() +
    theme_classic() +
    theme(plot.title = element_text(size = rel(2), face=&quot;bold&quot;, vjust=-4)) +
    theme(legend.position = &quot;bottom&quot;) +
    theme(legend.direction = &quot;horizontal&quot;) +
    labs(title=&quot;Title&quot;) 
  </code></pre>
  <p>As you can see, I have already tried adding in the line <code>theme(legend.direction = &quot;horizontal&quot;)</code> but I still get a legend which displays the items in 5 2-row columns (yes, its not even just in two rows).</p>
  <p>Now I can only assume that there has been some update that I was not aware of or something, so I'm willing to accept that I need to come up with a new strategy for dealing with this problem (which just wasn't a problem last week). Although I am a little bit confused about why my code has suddenly decided to stop working (any input on this welcome), I'm more interested in finding a fix for the immediate problem of my legend items being displayed in a strange configuration.</p>