title: Custom Legend Matlab 2014b
body: <p>I have a figure where I had some plots trough different functions using <code>hold on</code>.</p>
  
  <p>When I want to create my Legend, I don't have access to all the handle of my figures.</p>
  
  <p>Is there a way to create an independent Legend by defining the tip of the plot and the string for the description?</p>
  
  <p>For example I would like to be able to do:</p>
  
  <pre><code>figure;
  plot(0:0.1:pi, sin(0:0.1:pi), 'b-');
  customLegend('r.', 'red dots');
  </code></pre>
  
  <p>In the previous version it was possible to create a virtual plot using:</p>
  
  <pre><code>h1 = plot([], [], 'r.');
  legend(h1, 'red dots');
  </code></pre>
  
  <p>For example I want to change from the image of the left to the image of the right:</p>
  
  <p><img src="https://i.stack.imgur.com/o8DEv.png" alt="enter image description here"></p>