title: How to add legend to ggplot manually? - R
body: <p>I have the following plot:</p>
  
  <p><img src="https://i.stack.imgur.com/8H0ai.png" alt="Plot"></p>
  
  <p>The code I used to generate this plot was:</p>
  
  <pre><code>ggplot(df, aes(x = instance, y = total_hits))+
  geom_point(size = 1)+
  geom_line()+
  geom_line(aes(x=df$instance, y = line1), colour="red")+
  geom_vline(xintercept=805) +
  geom_line(aes(x=df$instance, y = line2), colour="blue")+
  geom_line(aes(x=df$instance, y = line3), colour="purple") 
  </code></pre>
  
  <p>I would like to add a legend to this plot, to label each line. However, since I added each line manually, I am not sure how to add the legend. Any tips/advice?</p>
  
  <ul>
  <li>I cannot share the data I am using, so I am just looking for a general way to add legends manually.</li>
  </ul>