title: Matlab - how to make a custom legend
body: <p>I have the following picture : </p>
  
  <p><img src="https://i.stack.imgur.com/o8JvI.png" alt="enter image description here"></p>
  
  <p>And I would like to make a legend for it. Basically, I want to make a legend for each type of rectangle. In the legend box, I want to mark each color line according to the type of body which it marks:</p>
  
  <ul>
  <li>green line : head</li>
  <li>yellow line : torso </li>
  <li>purple line : right arm</li>
  <li>cyan line : left arm</li>
  <li>red line : left leg</li>
  <li>blue line : right leg</li>
  </ul>
  
  <p>This is basically custom, because I have more rectangles of each type. How can I do a custom legend and attach it to the figure which draws this picture?</p>