This function allows to add multiple legends to a single figure / axes.
Simply define the typical legend properties such as DisplayName, LineStyle, Color, ... and there you go.
All additional settings such as Orientation, Location, ... could be freely choosen for each of the extra legends.
The contained examlpe shows the "ordinary" legend together with three additional legends.
Alexander Mering (2020). AddMultipleLegends (https://www.mathworks.com/matlabcentral/fileexchange/43657-addmultiplelegends), MATLAB Central File Exchange. Retrieved .
Exactly what I needed. However:
1) I don't want to plot the standard legend, so I added "legend off" after line 92
2) I had to set to 'on' the Visibility in this line: set(allchild(second_axes_handle(legend_num)),'Visible','on'). Otherwise I get the legend a bit greyish-shaded.
matlab's legend is pretty awkward; this routines helps; it allows adding legend of some selected plot handles without disturbing the existing legend/
the only thing is i wish the setup is a little simpler tho