It is relatively simple to add basic modifications to markers in matlab legends. The legend produced by the following code snippet (
):
hold on
h = plot(inf,inf,'ob',inf,inf,'r+');
legend(h,'Data1','Data2');
Can be easily modified to:
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
(circle is not in the middle of a line) or
(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?