This short function will generate a legend based on 'Tag' information given by plot. A legend title is also possible.
figure; hold on; x = 1:10; plot(x,x,'Tag','Positive'); plot(x,-x,'Tag','Negative'); labelplot('eo','v','Slope');
The above example is equivalent to
and adding a text box 'Slope' above it.
Fantastic - just what I was looking for! Generates perfect legends which does not require me to specify a fixed number of plot lines! Thanks!
Add BSD licence.
Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.