File Exchange

image thumbnail

AddMultipleLegends

version 1.0.0.0 (3.2 KB) by Alexander Mering
Add as many legend you want to a single figure

5 Downloads

Updated 27 Sep 2013

View License

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.

Cite As

Alexander Mering (2020). AddMultipleLegends (https://www.mathworks.com/matlabcentral/fileexchange/43657-addmultiplelegends), MATLAB Central File Exchange. Retrieved .

Comments and Ratings (2)

Giorgio

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.

p kung

very good.

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

thanks

MATLAB Release Compatibility
Created with R2011b
Compatible with any release
Platform Compatibility
Windows macOS Linux