title: advanced customization of legend markers in matlab
body: <p>It is relatively simple to add basic modifications to markers in matlab legends. The legend produced by the following code snippet (<a href="https://i.stack.imgur.com/tE0Xz.png" rel="noreferrer"><img src="https://i.stack.imgur.com/tE0Xz.png" alt="basic legend"></a>):</p>
  
  <p><code>hold on
  h = plot(inf,inf,'ob',inf,inf,'r+');
  legend(h,'Data1','Data2');</code></p>
  
  <p>Can be easily modified to: <a href="https://i.stack.imgur.com/OGLQt.png" rel="noreferrer"><img src="https://i.stack.imgur.com/OGLQt.png" alt="modified legend"></a> using the following code:</p>
  
  <p><code>[~,~,icons,~] = legend(h,'Data1','Data2');
  set(icons(1),'LineStyle','-')
  set(icons(2),'LineStyle','-')</code></p>
  
  <p>However things become fairly complicated if I want to correctly legend objects such as <a href="https://i.stack.imgur.com/WStyy.png" rel="noreferrer"><img src="https://i.stack.imgur.com/WStyy.png" alt="object1"></a> (circle is not in the middle of a line) or <a href="https://i.stack.imgur.com/F2ifX.png" rel="noreferrer"><img src="https://i.stack.imgur.com/F2ifX.png" alt="object2"></a> (several colors for one line with '+' markers on it). I have not found any property or workaround that allows to modify the position of the markers in the legend box, or add several markers in one legend group.</p>
  
  <p>Does anyone know of a document that contains advanced information for legend customization? Or how to better use the numerous properties of graphic objects provided by matlab to achieve what is described above?</p>