title: legend for group of lines
body: <p>I like to plot two groups of lines in the same plot. Each group has two lines with same color and I have to draw them in the order of one group after another group. I try to show legend for groups only not for lines. How can I do this? Here is a simplification of my wrong code:</p>
  
  <pre><code>plot(x1, y1, color1); hold on;
  plot(x2, y2, color1); hold on;
  
  plot(x3, y3, color2); hold on;
  plot(x4, y4, color2); hold on;
  
  legend({color1, color2})
  </code></pre>
  
  <p>Thanks!</p>
  
  <hr>
  
  <p>UPDATE:</p>
  
  <p>A new question, is there any way to write legend after each line and without overwriting the previous legend but append to it? i.e. something similar to "hold on" but applied to legend.</p>