advanced customization of legend markers in matlab

Viewed 2445

It is relatively simple to add basic modifications to markers in matlab legends. The legend produced by the following code snippet (basic legend):

hold on h = plot(inf,inf,'ob',inf,inf,'r+'); legend(h,'Data1','Data2');

Can be easily modified to: modified legend using the following code:

[~,~,icons,~] = legend(h,'Data1','Data2'); set(icons(1),'LineStyle','-') set(icons(2),'LineStyle','-')

However things become fairly complicated if I want to correctly legend objects such as object1 (circle is not in the middle of a line) or object2 (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.

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?

1 Answers
Related