title: How to change color legend from continues to discrete colors in ggplot2?
body: <p>I have created a line graph using ggplot2 and the color legend is continuous. I would like to change that to discrete colored lines. I have the following code:</p>
  <pre><code>library(ggplot2)
  ggplot(df, aes(L)) +
   geom_line(aes(y = Updated, colour = S, group = S, linetype = &quot;Updated&quot;)) +
   geom_line(aes(y = Current, colour = S, group = S, linetype = &quot;Current&quot;)) +
   scale_color_gradient() +
   labs(x = element_text(&quot;Span Length (ft)&quot;), y = element_blank(), 
           title = &quot;Moment Live Load Distribution Factors \n Exterior Girder - Multi Lane&quot;,
        linetype = &quot;AASHTO&quot;, color = &quot;Spacing (ft)&quot;) +
    scale_linetype_manual(values = c(1, 3),
                          labels = c(&quot;Updated&quot;, &quot;Current&quot;)) +
      theme_classic() +
      theme(plot.title = element_text(hjust = 0.5, margin = margin(0,0,20,0), size = 18),
            legend.position=&quot;top&quot;,
            legend.box.background = element_rect(colour = &quot;black&quot;, size = 0.5),
            legend.box.margin = margin(0,0,0,0), legend.background = element_blank())
  </code></pre>
  <p>At the moment my graph looks like
  <a href="https://i.stack.imgur.com/LHtW4.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/LHtW4.png" alt="enter image description here" /></a></p>
  <p>I would like to convert the continuous part of the legend to just colored lines with the same width as the remainder of the legend. Thank you!</p>