File Exchange

image thumbnail

Add Legend Automatically Based on Tag Property Value

version 1.0.0.0 (3.29 KB) by Hannes Mogensen
Add legend to axes based on values from plot handles Tag property

1 Download

Updated 30 Jul 2016

View License

Instead of adding a legend manually and making sure the colors are consistent, use the 'Tag' property for each plot to separate them. Then use the function add_legend to add a legend. The function groups all plots based on their Tag property, and give each group a separate color. It uses the Tag property values as labels in the legend.
I have included the function varycolor by Daniel Helmick:

https://www.mathworks.com/matlabcentral/fileexchange/21050-varycolor

Comments and Ratings (0)

Updates

1.0.0.0

Added credit to Daniel Helmick

1.0.0.0

Updated description

MATLAB Release Compatibility
Created with R2016a
Compatible with any release
Platform Compatibility
Windows macOS Linux
Tags Add Tags
Acknowledgements

Inspired by: varycolor