title: How to add colour matched legend to a R matplot
body: <p>I plot several lines on a graph using matplot:</p>
  
  <pre><code>matplot(cumsum(as.data.frame(daily.pnl)),type="l")
  </code></pre>
  
  <p>This gives me default colours for each line - which is fine,</p>
  
  <p>But I now want to add a legend that reflects those same colours - how can I achieve that?</p>
  
  <p>PLEASE NOTE - I am trying NOT to specify the colours to matplot in the first place.</p>
  
  <pre><code>legend(0,0,legend=spot.names,lty=1)
  </code></pre>
  
  <p>Gives me all the same colour.</p>